From 90f2bbe0126bbbd1b3b1a26b9a815e815a782cf1 Mon Sep 17 00:00:00 2001 From: Bernhard Roider Date: Tue, 5 Jun 2007 19:02:06 +0000 Subject: [PATCH] Fix crash with multiple windows: Disconnect the Dialog::hideSlot signal for a deleted Dialog instance. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18684 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/Dialogs.cpp | 6 +++++- src/frontends/Dialogs.h | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/frontends/Dialogs.cpp b/src/frontends/Dialogs.cpp index 35d4e013d7..a95950c784 100644 --- a/src/frontends/Dialogs.cpp +++ b/src/frontends/Dialogs.cpp @@ -71,9 +71,13 @@ Dialogs::Dialogs(LyXView & lyxview) : lyxview_(lyxview), in_show_(false) { // Connect signals - hideSignal().connect(boost::bind(&Dialogs::hideSlot, this, _1, _2)); + connection_ = hideSignal().connect(boost::bind(&Dialogs::hideSlot, this, _1, _2)); } +Dialogs::~Dialogs() +{ + connection_.disconnect(); +} Dialog * Dialogs::find_or_build(string const & name) { diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 323deee995..a81b7536a7 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -31,6 +31,8 @@ class Dialogs : boost::noncopyable { public: /// Dialogs(LyXView &); + /// + ~Dialogs(); /** Check the status of all visible dialogs and disable or reenable * them as appropriate. @@ -116,6 +118,9 @@ private: /// flag against a race condition due to multiclicks in Qt frontend, see bug #1119 bool in_show_; + + /// + boost::signals::connection connection_; }; } // namespace lyx