mview->ref = ref; /* No retain */
IntGroupClear(mview->tableCache);
IntGroupClear(mview->tableSelection);
- MoleculeCallback_notifyModification(mview->mol, 0);
+ if (mview->ref != NULL)
+ MoleculeCallback_notifyModification(mview->mol, 0);
}
}
return false;
//#endif
+ wxDocChildFrame *saveFrame = frame;
+
// Dispose relationship between this and Molecule (MainView)
MainView_setViewObject(mview, NULL);
mview = NULL;
-
+ // We do not know about the frame anymore
+ frame = NULL;
+ canvas = NULL;
+
// Remove this from the active view list
sActiveViews.Remove(this);
wxGetApp().Disconnect(MyDocumentEvent_scriptMenuModified, MyDocumentEvent, wxCommandEventHandler(MoleculeView::OnScriptMenuModified), NULL, this);
if (deleteWindow) {
- frame->Destroy();
+ saveFrame->Destroy();
}
// Check if all windows are gone
- wxGetApp().CheckIfAllWindowsAreGone(frame);
+ wxGetApp().CheckIfAllWindowsAreGone(saveFrame);
return true;
}
sActiveViews.Insert(this, 0);
}
wxView::Activate(activate);
- frame->Refresh();
+ if (frame != NULL)
+ frame->Refresh();
}
wxPrintout *