diff --git a/src/frontends/Application.C b/src/frontends/Application.C index 545b15e33a..5b8d846b59 100644 --- a/src/frontends/Application.C +++ b/src/frontends/Application.C @@ -41,8 +41,6 @@ namespace frontend { /// The main application class private implementation. struct Application_pimpl { - /// - BufferList buffer_list_; /// our function handler boost::scoped_ptr lyxfunc_; /// @@ -94,18 +92,6 @@ LyXServerSocket const & Application::socket() const } -BufferList & Application::bufferList() -{ - return pimpl_->buffer_list_; -} - - -BufferList const & Application::bufferList() const -{ - return pimpl_->buffer_list_; -} - - void Application::setBufferView(BufferView * buffer_view) { buffer_view_ = buffer_view; @@ -177,12 +163,6 @@ LyXFunc & theLyXFunc() } -BufferList & theBufferList() -{ - return theApp->bufferList(); -} - - lyx::frontend::FontLoader & theFontLoader() { return theApp->fontLoader(); diff --git a/src/frontends/Application.h b/src/frontends/Application.h index d9589f8078..b1eff4ecfa 100644 --- a/src/frontends/Application.h +++ b/src/frontends/Application.h @@ -87,9 +87,6 @@ public: /// LyXServerSocket & socket(); LyXServerSocket const & socket() const; - /// - BufferList & bufferList(); - BufferList const & bufferList() const; /// Create the main window with given geometry settings. LyXView & createView(unsigned int width, unsigned int height, diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 6cbe384d13..0735a98f98 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -216,7 +216,9 @@ void quitLyX(bool noask) Alert::warning(_("Unable to remove temporary directory"), msg); } - theApp->exit(0); + if (lyx_gui::use_gui) + theApp->exit(0); + // Restore original font resources after Application is destroyed. lyx::support::restoreFontResources(); } diff --git a/src/lyx_main.C b/src/lyx_main.C index 0f98482706..6a05a113a5 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -169,9 +169,29 @@ LyX const & LyX::cref() } +BufferList & theBufferList() +{ + return LyX::ref().bufferList(); +} + + LyX::LyX() : first_start(false), geometryOption_(false) -{} +{ + buffer_list_.reset(new BufferList); +} + + +BufferList & LyX::bufferList() +{ + return *buffer_list_.get(); +} + + +BufferList const & LyX::bufferList() const +{ + return *buffer_list_.get(); +} lyx::Session & LyX::session() diff --git a/src/lyx_main.h b/src/lyx_main.h index 55fdd631b6..c791c605f8 100644 --- a/src/lyx_main.h +++ b/src/lyx_main.h @@ -22,6 +22,7 @@ #include class Buffer; +class BufferList; class ErrorItem; class InsetBase; class LyXView; @@ -55,6 +56,10 @@ public: /// in the case of failure void emergencyCleanup() const; + /// + BufferList & bufferList(); + BufferList const & bufferList() const; + /// lyx::Session & session(); lyx::Session const & session() const; @@ -102,6 +107,8 @@ private: /// the parsed command line batch command if any std::string batch_command; + /// + boost::scoped_ptr buffer_list_; /// lyx session, containing lastfiles, lastfilepos, and lastopened boost::scoped_ptr session_; ///