Peter Kümmel wrote:
Abdelrazak Younes wrote:
Peter Kümmel wrote:
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.
Did you test with multiple windows?
Yes, but it works as expected,
it only quits if views_.empty() is true.
OK.
More comment below...
------------------------------------------------------------------------
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"));
I seem to remember that "force" was not doing anything really... not
sure about that.
case LFUN_LYX_QUIT:
if (argument != "force") {
if (!theApp->gui().closeAll())
break;
lyx_view_ = 0;
}
didn't know what it is good for.
Seems this code is never used. LFUN_LYX_QUIT, is only called in:
guiImplementation.C(107): dispatch(FuncRequest(LFUN_LYX_QUIT,
"force"));
Only in your version. In svn it is in GuiApplication::quitLyX() (line
169). And that's the only place where LFUN_LYX_QUIT is dispatched. At
one point, the other case (without "force") was also used for the
non-gui case, but I reworked that.
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()));
IIUC, then we rely on Qt behaving correctly on quitOnLastWindowClosed.
This was not possible at the time I implement the multi-windows because
some things were not destroyed in the correct order. But I have done a
lot of cleanup in the LyX class after that so it is quite possible that
it is OK now.
I use Qt 4.2.1. and it works on Windows. On Mac, too, but I don't know the
Qt version Bennett is using, wasn't it also 4.2.1?
I think he's using the latest version indeed.
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);
You should not need to do that explicitily. LyX::exec() will return in
main() and that should be the normal exit path.
without the exit(0) you go back into some Qt-event-handling code
and you will get a crashes, so exit(0) is necessary at this place.
But this could also be a sign that something is wrong in the code.
Exactly my point. With current svn, it is not necessary and everything
is destroyed in the correct order on Windows and I believe also Linux
without requiring a hard ::exit(0).
Abdel.