From 832a46885acdd1ab0178d29df02d69507b1d7f15 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 22 Feb 2005 10:25:42 +0000 Subject: [PATCH] Andreas' "in_show" fix to bug 1119. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9661 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/ChangeLog | 5 +++++ src/frontends/Dialogs.C | 32 ++++++++++++++++++++------------ src/frontends/Dialogs.h | 3 +++ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index bbbeb2c4af..77955ee2bb 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,8 @@ +2005-02-21 Andreas Vox + + * Dialogs.[hC] (show): prevent show() from getting called + recursively. + 2005-02-11 John Levon * screen.C: clarify comment about event queue magic diff --git a/src/frontends/Dialogs.C b/src/frontends/Dialogs.C index 0c222c045e..5e5a42d444 100644 --- a/src/frontends/Dialogs.C +++ b/src/frontends/Dialogs.C @@ -65,7 +65,7 @@ void Dialogs::hide(string const & name, InsetBase* inset) Dialogs::Dialogs(LyXView & lyxview) - : lyxview_(lyxview) + : lyxview_(lyxview), in_show_(false) { // Connect signals redrawGUI().connect(boost::bind(&Dialogs::redraw, this)); @@ -90,24 +90,32 @@ Dialog * Dialogs::find_or_build(string const & name) void Dialogs::show(string const & name, string const & data) { - Dialog * dialog = find_or_build(name); - if (!dialog) + if (in_show_) { return; - - // FIXME! Should check that the dialog is NOT an inset dialog. - dialog->show(data); + } + in_show_ = true; + Dialog * dialog = find_or_build(name); + if (dialog) { + // FIXME! Should check that the dialog is NOT an inset dialog. + dialog->show(data); + } + in_show_ = false; } void Dialogs::show(string const & name, string const & data, InsetBase * inset) { - Dialog * dialog = find_or_build(name); - if (!dialog) + if (in_show_) { return; - - // FIXME! Should check that the dialog IS an inset dialog. - dialog->show(data); - open_insets_[name] = inset; + } + in_show_ = true; + Dialog * dialog = find_or_build(name); + if (dialog) { + // FIXME! Should check that the dialog IS an inset dialog. + dialog->show(data); + open_insets_[name] = inset; + } + in_show_ = false; } diff --git a/src/frontends/Dialogs.h b/src/frontends/Dialogs.h index 22ab1784d6..7817de4d0c 100644 --- a/src/frontends/Dialogs.h +++ b/src/frontends/Dialogs.h @@ -117,6 +117,9 @@ private: /// std::map dialogs_; + + /// flag against a race condition due to multiclicks in Qt frontend, see bug #1119 + bool in_show_; }; #endif