X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyx_main.C;h=caa2a2b6897730040b8fa97abcefda1667b6cf0a;hb=c4320d24cd2d29c2e77958b4a8fd44f2bd587ca7;hp=23692a194f8466c217746cef8b46dee6b68199be;hpb=ed99f752f9b4ce52cf55cac2a94658fb087c7383;p=lyx.git diff --git a/src/lyx_main.C b/src/lyx_main.C index 23692a194f..caa2a2b689 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -177,13 +177,6 @@ frontend::Application * theApp() LyX::~LyX() { - // Static data are not treated in the same way at all on the Mac (and - // the LyX singleton has static methods). This is the reason why the - // exit command on the Mac bypasses our dispatch machinery altogether. - // On Linux and Windows we won't pass a second time through quit() - // because quitting will already be set to true. - if (!quitting) - quit(); } @@ -402,12 +395,7 @@ int LyX::exec(int & argc, char * argv[]) exit_status = pimpl_->application_->exec(); - // FIXME: Do we still need this reset? - // I assume it is the reason for strange Mac crashs - // Test by reverting rev 16110 (Peter) - // Kill the application object before exiting. This avoid crash - // on exit on Linux. - pimpl_->application_.reset(); + prepareExit(); // Restore original font resources after Application is destroyed. support::restoreFontResources(); @@ -442,6 +430,19 @@ void LyX::prepareExit() from_utf8(package().temp_dir())); Alert::warning(_("Unable to remove temporary directory"), msg); } + + if (use_gui) { + if (pimpl_->session_) + pimpl_->session_->writeFile(); + pimpl_->session_.reset(); + pimpl_->lyx_server_.reset(); + pimpl_->lyx_socket_.reset(); + } + + // Kill the application object before exiting. This avoids crashes + // when exiting on Linux. + if (pimpl_->application_) + pimpl_->application_.reset(); } @@ -455,22 +456,6 @@ void LyX::earlyExit(int status) } -void LyX::quit() -{ - lyxerr[Debug::INFO] << "Running QuitLyX." << endl; - - prepareExit(); - if (use_gui) { - if (pimpl_->session_) - pimpl_->session_->writeFile(); - pimpl_->lyx_server_.reset(); - pimpl_->lyx_socket_.reset(); - if (pimpl_->application_) - pimpl_->application_->exit(0); - } -} - - int LyX::loadFiles(int & argc, char * argv[], vector & files) {