Hello,

there is a crash and i can tell the reason. As i have no time investigate further i post to the list what i already found out.

to reproduce:
1. start lyx
2. open a document that contains insets
3. open another window (new window)
4. close the second window
5. close the document in the first window -> crash (sometimes)

the reason:
- in step 3 an instance of class Dialog is created for the second window
- in step 4 this instance is deleted again
- in step 5 the signal hideSlot is sent to the already deleted dialog. This 
sometimes gives a segfault.

the reason is easy to verify from debug output if you apply the attached patch.

I think it's again a missing disconnect() somewhere.

Bernhard
Index: src/frontends/Dialogs.cpp
===================================================================
--- src/frontends/Dialogs.cpp   (revision 18642)
+++ src/frontends/Dialogs.cpp   (working copy)
@@ -21,6 +21,7 @@
 #include <boost/signal.hpp>
 #include <boost/bind.hpp>
 
+#include "debug.h"
 
 namespace lyx {
 
@@ -70,10 +71,14 @@
 Dialogs::Dialogs(LyXView & lyxview)
        : lyxview_(lyxview), in_show_(false)
 {
+       lyxerr << "create " << unsigned(this) << std::endl;
        // Connect signals
        hideSignal().connect(boost::bind(&Dialogs::hideSlot, this, _1, _2));
 }
 
+Dialogs::~Dialogs() {
+       lyxerr << "delete " << unsigned(this) << std::endl;
+}
 
 Dialog * Dialogs::find_or_build(string const & name)
 {
@@ -147,6 +152,7 @@
 
 void Dialogs::hideSlot(string const & name, Inset * inset)
 {
+       lyxerr << "hide " << unsigned(this) << " " << name << std::endl;
        std::map<string, DialogPtr>::const_iterator it =
                dialogs_.find(name);
        if (it == dialogs_.end())
Index: src/frontends/Dialogs.h
===================================================================
--- src/frontends/Dialogs.h     (revision 18642)
+++ src/frontends/Dialogs.h     (working copy)
@@ -39,6 +39,8 @@
         *  cursor moves to a position where the corresponding inset is not
         *  allowed.
         */
+       ~Dialogs();
+
        void checkStatus();
 
        /// Are the tooltips on or off?

Reply via email to