Abdelrazak Younes wrote:
 > I suggest that you test this carefully before applying. You don't want
> to know how much time I spent to get it right on windows.

Do you see/have problems with the attached patch?

Here on windows it works fine. It also removes the
buggy Qt code.

Bennett, could you please test it one more time.

Thanks,
Peter
Index: src/frontends/qt4/GuiImplementation.C
===================================================================
--- src/frontends/qt4/GuiImplementation.C       (revision 15972)
+++ src/frontends/qt4/GuiImplementation.C       (working copy)
@@ -104,9 +104,7 @@
        buildViewIds();
 
        if (views_.empty()) {
-               theLyXFunc().setLyXView(0);
-//             dispatch(FuncRequest(LFUN_LYX_QUIT));
-               return;
+               dispatch(FuncRequest(LFUN_LYX_QUIT, "force"));
        }
 
        theLyXFunc().setLyXView(views_.begin()->second);
Index: src/frontends/qt4/GuiApplication.C
===================================================================
--- src/frontends/qt4/GuiApplication.C  (revision 15975)
+++ src/frontends/qt4/GuiApplication.C  (working copy)
@@ -159,25 +159,10 @@
        This feature be turned off by setting quitOnLastWindowClosed to false.
        */
        setQuitOnLastWindowClosed(false);
-       // this connect should not be necessary: 
-       // we rely on a Qt bug on Windows and maybe Linux
-       QObject::connect(this, SIGNAL(lastWindowClosed()),
-               this, SLOT(quitLyX()));
 
        guiApp = this;
 }
 
-
-void GuiApplication::quitLyX()
-{
-       theLyXFunc().setLyXView(0);
-
-       // trigger LFUN_LYX_QUIT instead of QApplication::quit() directly
-       // since LFUN_LYX_QUIT may have more cleanup stuff
-       dispatch(FuncRequest(LFUN_LYX_QUIT, "force"));
-}
-
-
 Clipboard& GuiApplication::clipboard()
 {
        return clipboard_;
Index: src/frontends/qt4/GuiApplication.h
===================================================================
--- src/frontends/qt4/GuiApplication.h  (revision 15972)
+++ src/frontends/qt4/GuiApplication.h  (working copy)
@@ -83,10 +83,6 @@
        ///
        GuiFontLoader & guiFontLoader() { return font_loader_; }
 
-private Q_SLOTS:
-       /// request an LFUN_LYX_QUIT
-       void quitLyX();
-
 private:
        ///
        GuiImplementation gui_;
Index: src/lyx_main.C
===================================================================
--- src/lyx_main.C      (revision 15973)
+++ src/lyx_main.C      (working copy)
@@ -410,15 +410,20 @@
 {
        lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
 
+       theLyXFunc().setLyXView(0);
+
        prepareExit();
 
        if (use_gui) {
                pimpl_->session_->writeFile();
                pimpl_->lyx_server_.reset();
                pimpl_->lyx_socket_.reset();
+               // this calls Qt's exit which does return
                pimpl_->application_->exit(0);
                theApp = 0;
        }
+       // this is the point of leaving lyx normally
+       ::exit(0);
 }
 
 

Reply via email to