Permalink
Browse files

Merge pull request #408 from ales-erjavec/cleanup-qgraphics-scene-init

Fix `cleanup` when the running qt application is not a QApplication
  • Loading branch information...
2 parents 183ca1f + c4c31c3 commit fe90f46bdda415f1f9e61869597893e256e646d5 @campagnola campagnola committed on GitHub Dec 14, 2016
Showing with 4 additions and 1 deletion.
  1. +4 −1 pyqtgraph/__init__.py
@@ -303,7 +303,10 @@ def cleanup():
## ALL QGraphicsItems must have a scene before they are deleted.
## This is potentially very expensive, but preferred over crashing.
## Note: this appears to be fixed in PySide as of 2012.12, but it should be left in for a while longer..
- if QtGui.QApplication.instance() is None:
+ app = QtGui.QApplication.instance()
+ if app is None or not isinstance(app, QtGui.QApplication):
+ # app was never constructed is already deleted or is an
+ # QCoreApplication/QGuiApplication and not a full QApplication
return
import gc
s = QtGui.QGraphicsScene()

0 comments on commit fe90f46

Please sign in to comment.