mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-06 05:16:40 +08:00
Fix PyQt4 segfault caused by PySide fix.
I guess PySide saves the QApplication internally, while PyQt4 doesn't. Saving the QApplication as a global prevents it from getting garbage collected. Saving the QApplication as an instance variable in the ImageViewer also works, but that might prevent the ImageViewer from getting garbage collected in an interactive session. (weakref doesn't seem to work here.)
This commit is contained in:
@@ -22,15 +22,19 @@ __all__ = ['init_qtapp', 'start_qtapp', 'RequiredAttr', 'figimage',
|
||||
'update_axes_image']
|
||||
|
||||
|
||||
global QApp
|
||||
|
||||
|
||||
def init_qtapp():
|
||||
"""Initialize QAppliction.
|
||||
|
||||
The QApplication needs to be initialized before creating any QWidgets
|
||||
"""
|
||||
app = QtGui.QApplication.instance()
|
||||
if app is None:
|
||||
app = QtGui.QApplication([])
|
||||
return app
|
||||
global QApp
|
||||
QApp = QtGui.QApplication.instance()
|
||||
if QApp is None:
|
||||
QApp = QtGui.QApplication([])
|
||||
return QApp
|
||||
|
||||
|
||||
def is_event_loop_running(app=None):
|
||||
|
||||
Reference in New Issue
Block a user