diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvirc/ui/kvi_window.cpp | 15 | ||||
| -rw-r--r-- | src/modules/editor/libkvieditor.cpp | 8 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/kvirc/ui/kvi_window.cpp b/src/kvirc/ui/kvi_window.cpp index 9fd8899d2..70205236b 100644 --- a/src/kvirc/ui/kvi_window.cpp +++ b/src/kvirc/ui/kvi_window.cpp @@ -892,7 +892,20 @@ void KviWindow::delayedClose() void KviWindow::closeEvent(QCloseEvent *e) { e->ignore(); - g_pFrame->childWindowCloseRequest(this); + if(g_pFrame) + { + g_pFrame->childWindowCloseRequest(this); + } else { + /* In kvi_app destructor, g_pFrame gets deleted before modules gets unloaded. + * So if a module tries to destroy a kviwindow while it gets unloaded, we end up here, + * having to delete this window without the help of g_pFrame. + * So we have 3 choices: + * 1) delete this => will just print a qt warning "don't delete things on their event handler" + * 2) deleteLater() => will tipically create an infinite recursion in the module unload routine + * 3) do nothing => same as #2 + */ + delete this; + } } void KviWindow::updateIcon() diff --git a/src/modules/editor/libkvieditor.cpp b/src/modules/editor/libkvieditor.cpp index b9290840f..6f36648e8 100644 --- a/src/modules/editor/libkvieditor.cpp +++ b/src/modules/editor/libkvieditor.cpp @@ -44,6 +44,13 @@ static bool editor_module_init(KviModule * m) static bool editor_module_cleanup(KviModule *) { + /* + * This causes 2 crashes: one in KviApp destructor (closing windows needs + * g_pFrame, that is deleted before this unloading routine) and the second in + * the codetester window (it deletes us in its denstructor, and we tries to back-delete it) + * So it's commented out by now.. + */ +/* while(g_pScriptEditorWindowList->first()) { QObject * w = g_pScriptEditorWindowList->first()->parent();; @@ -61,6 +68,7 @@ static bool editor_module_cleanup(KviModule *) } delete g_pScriptEditorWindowList->first(); } +*/ delete g_pScriptEditorWindowList; g_pScriptEditorWindowList = 0; |
