Commit b554460b authored by Kendrick, Coleman's avatar Kendrick, Coleman
Browse files

Fix close handling of instrument viewer

parent 6bf418d2
......@@ -87,8 +87,8 @@ class InstrumentViewPresenter(ObservingPresenter):
InstrumentViewManager.last_view = None
if workspace_name == self.ws_name:
InstrumentViewManager.remove(self.ws_name)
super(InstrumentViewPresenter, self).close(self.ws_name)
InstrumentViewManager.remove(self.ws_name)
class InstrumentViewManager:
......
......@@ -92,13 +92,18 @@ class InstrumentView(QWidget, ObservingView):
self.widget.replaceWorkspace(new_ws_name, new_window_name)
def closeEvent(self, event):
# pass close event through to the underlying C++ widget
children = self.findChildren(InstrumentWidget)
for child in children:
child.close()
self.presenter.close(self.name)
# ordering of close events is different depending on
# whether workspace is deleted or window is closed
if self.presenter is not None:
# pass close event through to the underlying C++ widget
children = self.findChildren(InstrumentWidget)
for child in children:
child.close()
self.presenter.close(self.name)
super(InstrumentView, self).closeEvent(event)
@Slot()
def _run_close(self):
# clear presenter to act as flag for processing in closeEvent
self.presenter = None
self.close()
......@@ -356,7 +356,6 @@ void InstrumentWidget::resetInstrumentActor() {
m_thread.wait();
m_instrumentActor.reset(new InstrumentActor(m_workspaceName, m_autoscaling, m_scaleMin, m_scaleMax));
m_instrumentActor->moveToThread(&m_thread);
connect(&m_thread, &QThread::finished, m_instrumentActor.get(), &QObject::deleteLater);
connect(m_instrumentActor.get(), SIGNAL(initWidget()), this, SLOT(initWidget()));
m_thread.start();
QMetaObject::invokeMethod(m_instrumentActor.get(), "initialize", Qt::QueuedConnection);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment