- BOOST_ASSERT(!singleton_.get());
- // We must return from this before launching the gui so that
- // other parts of the code can access singleton_ through
- // LyX::ref and LyX::cref.
- singleton_.reset(new LyX);
- // Start the real execution loop.
- return singleton_->priv_exec(argc, argv);
+ // 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();