Skip to content

Commit

Permalink
Ensure observers in GlobalFigureManager are destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
robertapplin committed Aug 14, 2023
1 parent e8369a1 commit 4d64687
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/mslice/plotting/globalfiguremanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def destroy_all(cls):
}
cls._activeQue = []
cls._figures.clear()
cls.observers = []

@classmethod
def has_fignum(cls, num):
Expand Down
4 changes: 3 additions & 1 deletion tests/app_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import unittest
from mock import patch
from mslice.app.mainwindow import MainWindow
from mslice.plotting.globalfiguremanager import GlobalFigureManager

qapp = None

Expand All @@ -15,6 +16,8 @@ def setUp(self):
qapp = QtWidgets.QApplication([' '])

def tearDown(self):
GlobalFigureManager.destroy_all()

# Required to sendPostedEvents twice to ensure the MainWindow is deleted
qapp.sendPostedEvents()
qapp.sendPostedEvents()
Expand All @@ -28,4 +31,3 @@ def test_mainwindow(self):
window = MainWindow()
window.setAttribute(Qt.WA_DeleteOnClose, True)
QTimer.singleShot(0, window.close)

0 comments on commit 4d64687

Please sign in to comment.