fixed a bug preventing quasel from crashing on exit
[quassel.git] / src / common / main_mono.cpp
index f0bafd9..84e6fae 100644 (file)
@@ -30,6 +30,7 @@
 #include "coreproxy.h"
 #include "settings.h"
 #include "chatwidget.h"
+#include "mainwin.h"
 
 int main(int argc, char **argv) {
   QApplication app(argc, argv);
@@ -50,12 +51,17 @@ int main(int argc, char **argv) {
   Settings::init();
   Style::init();
 
-  //MainWin *mainWin = new MainWin();
+  MainWin *mainWin = new MainWin();
   //mainWin->show();
-  //mainWin->init();
-  Client::instance();
+  Client::init(mainWin);
+  mainWin->init();
   int exitCode = app.exec();
   //delete core;
+  
+  // the mainWin has to be deleted before the Core
+  // if not Quassel will crash on exit under certain conditions since the gui
+  // still wants to access clientdata
+  delete mainWin;
   Client::destroy();
   Core::destroy();
   //delete guiProxy;