diff --git a/src/HomeWindow.cpp b/src/HomeWindow.cpp index 9c4e2336b..fcc6d7ed2 100644 --- a/src/HomeWindow.cpp +++ b/src/HomeWindow.cpp @@ -155,11 +155,12 @@ HomeWindow::HomeWindow(Context *context, QString name, QString /* windowtitle */ connect(titleEdit, SIGNAL(textChanged(const QString&)), SLOT(titleChanged())); installEventFilter(this); - application->installEventFilter(this); + qApp->installEventFilter(this); } HomeWindow::~HomeWindow() { + qApp->removeEventFilter(this); } void diff --git a/src/HomeWindow.h b/src/HomeWindow.h index 662a6fa2a..e85f6bb03 100644 --- a/src/HomeWindow.h +++ b/src/HomeWindow.h @@ -40,7 +40,6 @@ #include "QtMacSegmentedButton.h" #endif -extern QApplication *application; class ChartBar; class HomeWindow : public GcWindow diff --git a/src/main.cpp b/src/main.cpp index 022c06be9..9bbb3baf4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -58,7 +58,6 @@ void nostderr(QString dir) #include #endif -QApplication *application; bool restarting = false; // root directory shared by all @@ -142,7 +141,7 @@ main(int argc, char *argv[]) #endif // create the application -- only ever ONE regardless of restarts - application = new QApplication(argc, argv); + QApplication *application = new QApplication(argc, argv); #ifdef Q_OS_MAC // get an autorelease pool setup