]> git.lyx.org Git - lyx.git/commitdiff
fixes buffer closing crashes
authorAlfredo Braunstein <abraunst@lyx.org>
Fri, 11 Jul 2003 12:21:31 +0000 (12:21 +0000)
committerAlfredo Braunstein <abraunst@lyx.org>
Fri, 11 Jul 2003 12:21:31 +0000 (12:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7267 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/ChangeLog
src/buffer.C
src/buffer.h
src/lyxfunc.C

index 960389188d57eabd94524e2f5039ea345a72ce7d..3d89894972b5de29225ad3f3096151967117e357 100644 (file)
@@ -156,6 +156,7 @@ void BufferView::Pimpl::connectBuffer(Buffer & buf)
        titleConnection_ = buf.updateTitles.connect(boost::bind(&LyXView::updateWindowTitle, owner_));
        timerConnection_ = buf.resetAutosaveTimers.connect(boost::bind(&LyXView::resetAutosaveTimer, owner_));
        readonlyConnection_ = buf.readonly.connect(boost::bind(&BufferView::Pimpl::showReadonly, this, _1));
+       closingConnection_ = buf.closing.connect(boost::bind(&BufferView::Pimpl::buffer, this, (Buffer *)0));
 }
 
 
@@ -167,6 +168,7 @@ void BufferView::Pimpl::disconnectBuffer()
        titleConnection_.disconnect();
        timerConnection_.disconnect();
        readonlyConnection_.disconnect();
+       closingConnection_.disconnect();
 }
 
 
index 1e9c7fc297088d7ea0269d4a7c1767d06be3a7f6..b98a01ecc2565ee48299360028d1bbfe427381c1 100644 (file)
@@ -125,6 +125,8 @@ private:
        boost::signals::connection timerConnection_;
        /// buffer readonly status changed signal connection
        boost::signals::connection readonlyConnection_;
+       /// buffer closing signal connection
+       boost::signals::connection closingConnection_;
        /// connect to signals in the given buffer
        void connectBuffer(Buffer & buf);
        /// disconnect from signals in the given buffer
index 734c43f03b3f3cf7c407c3592ae6cf6dae0b8680..7c5303f8283f001811f014fe1c7a03e4dca3a478 100644 (file)
@@ -1,4 +1,11 @@
-2003-07-10  Alfredo Brauntein  <abraunst@libero.it>
+2003-07-11  Alfredo Braunstein  <abraunst@libero.it>
+
+       * buffer.[Ch]: added new closing signal
+       * BufferView_pimpl.[Ch]: connect/disconnect to new signal
+       * lyxfunc.C: removed BufferView::buffer(0) call now handled in 
+       BufferView::Pimpl via the closing the signal
+       
+2003-07-10  Alfredo Braunstein  <abraunst@libero.it>
 
        * buffer.[Ch]: take out all bv-related from buffer
        * BufferView.C: 
index 1ee9bd945be8c6e26c953bd031622e00b7b11a7b..1f1a39945eb7bcd9b073d81785a1b699b6f913f6 100644 (file)
@@ -145,6 +145,8 @@ Buffer::~Buffer()
        // here the buffer should take care that it is
        // saved properly, before it goes into the void.
 
+       closing();
+
        if (!tmppath.empty() && destroyDir(tmppath) != 0) {
                Alert::warning(_("Could not remove temporary directory"),
                        bformat(_("Could not remove the temporary directory %1$s"), tmppath));
index 4977513afe1dbb0e3302b9a4e5e78c0a752c1405..26abfd024aa0211fa09b69b269240e7ce6e3dba8 100644 (file)
@@ -117,6 +117,8 @@ public:
        boost::signal0<void> updateTitles;
        /// Reset autosave timers for all users.
        boost::signal0<void> resetAutosaveTimers;
+       /// This signal is emitting if the buffer is being closed.
+       boost::signal0<void> closing;
 
 
        /** Save file.
index 7aa4c0d6cf1fe41586919e2d4fc3331759fbeec3..96e6e86acde26615444a226b9393a19dc5c47ed5 100644 (file)
@@ -1909,9 +1909,8 @@ void LyXFunc::closeBuffer()
 {
        if (bufferlist.close(owner->buffer(), true) && !quitting) {
                if (bufferlist.empty()) {
-                       view()->buffer(0);
-                       // need this otherwise SEGV may occur while trying to
-                       // set variables that don't exist
+                       // need this otherwise SEGV may occur while 
+                       // trying to set variables that don't exist
                        // since there's no current buffer
                        owner->getDialogs().hideBufferDependent();
                } else {