From 8662fa2b8ff3a3e6fa5d4626c808c7583f84e5df Mon Sep 17 00:00:00 2001 From: Oleg Romashin Date: Wed, 17 Feb 2010 21:14:48 +0200 Subject: [PATCH] Bug 545651 - QApplication is not starting in tab child process. r=dougt --- dom/ipc/TabChild.cpp | 15 +++++++++++++++ widget/src/qt/nsAppShell.cpp | 18 ------------------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index c75bf52b46b..1c2d1f0a510 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -38,6 +38,7 @@ #ifdef MOZ_WIDGET_QT #include +#include #endif #include "TabChild.h" @@ -65,6 +66,12 @@ using namespace mozilla::dom; +#ifdef MOZ_WIDGET_QT +static QApplication *gQApp = nsnull; +extern int gArgc; +extern char **gArgv; +#endif + NS_IMPL_ISUPPORTS1(ContentListener, nsIDOMEventListener) NS_IMETHODIMP @@ -87,6 +94,9 @@ TabChild::Init() { #ifdef MOZ_WIDGET_GTK2 gtk_init(NULL, NULL); +#elif defined(MOZ_WIDGET_QT) + if (!qApp) + gQApp = new QApplication(gArgc, (char**)gArgv); #endif nsCOMPtr webBrowser = do_CreateInstance(NS_WEBBROWSER_CONTRACTID); @@ -324,6 +334,11 @@ TabChild::destroyWidget() TabChild::~TabChild() { +#ifdef MOZ_WIDGET_QT + if (gQApp) + delete gQApp; + gQApp = nsnull; +#endif destroyWidget(); nsCOMPtr webBrowser = do_QueryInterface(mWebNav); if (webBrowser) { diff --git a/widget/src/qt/nsAppShell.cpp b/widget/src/qt/nsAppShell.cpp index f9352b058fb..5c41e315e02 100644 --- a/widget/src/qt/nsAppShell.cpp +++ b/widget/src/qt/nsAppShell.cpp @@ -51,13 +51,6 @@ #include "prlog.h" #endif -#ifdef MOZ_IPC -#include -static QApplication *sQApp = nsnull; -extern int gArgc; -extern char **gArgv; -#endif - #ifdef PR_LOGGING PRLogModuleInfo *gWidgetLog = nsnull; PRLogModuleInfo *gWidgetFocusLog = nsnull; @@ -69,11 +62,6 @@ static int sPokeEvent; nsAppShell::~nsAppShell() { -#ifdef MOZ_IPC - if (sQApp) - delete sQApp; - sQApp = nsnull; -#endif } nsresult @@ -95,12 +83,6 @@ nsAppShell::Init() sPokeEvent = QEvent::User+5000; #endif -#ifdef MOZ_IPC - if (!qApp) { - sQApp = new QApplication(gArgc, (char**)gArgv); - } -#endif - return nsBaseAppShell::Init(); }