summaryrefslogtreecommitdiffstats
path: root/src/widgets/toolbox.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2012-01-01 11:45:32 +0000
committerJon A. Cruz <jon@joncruz.org>2012-01-01 11:45:32 +0000
commit8efbe2cbb9cda49278ec57c21551f943c7033fa4 (patch)
tree41e32ba9c6a874af9d6d4fc5b9b71948b91469d1 /src/widgets/toolbox.cpp
parentFix for Bug #494722 (Docked dialogs in a floating window crashes on shutdown)... (diff)
downloadinkscape-8efbe2cbb9cda49278ec57c21551f943c7033fa4.tar.gz
inkscape-8efbe2cbb9cda49278ec57c21551f943c7033fa4.zip
Added signal for desktop destruction to allow for proper removal of tracked stale pointers. Fixes bug #869067.
Fixed bugs: - https://launchpad.net/bugs/869067 (bzr r10814)
Diffstat (limited to 'src/widgets/toolbox.cpp')
-rw-r--r--src/widgets/toolbox.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 3a933db02..adfa334e1 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -886,6 +886,17 @@ static GtkAction* create_action_for_verb( Inkscape::Verb* verb, Inkscape::UI::Vi
return act;
}
+static std::map<SPDesktop*, Glib::RefPtr<Gtk::ActionGroup> > groups;
+
+static void desktopDestructHandler(SPDesktop *desktop)
+{
+ std::map<SPDesktop*, Glib::RefPtr<Gtk::ActionGroup> >::iterator it = groups.find(desktop);
+ if (it != groups.end())
+ {
+ groups.erase(it);
+ }
+}
+
static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* desktop )
{
Inkscape::UI::View::View *view = desktop;
@@ -934,7 +945,6 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto
Inkscape::IconSize toolboxSize = ToolboxFactory::prefToSize("/toolbox/small");
- static std::map<SPDesktop*, Glib::RefPtr<Gtk::ActionGroup> > groups;
Glib::RefPtr<Gtk::ActionGroup> mainActions;
if ( groups.find(desktop) != groups.end() ) {
mainActions = groups[desktop];
@@ -943,6 +953,10 @@ static Glib::RefPtr<Gtk::ActionGroup> create_or_fetch_actions( SPDesktop* deskto
if ( !mainActions ) {
mainActions = Gtk::ActionGroup::create("main");
groups[desktop] = mainActions;
+ if (desktop)
+ {
+ desktop->connectDestroy(&desktopDestructHandler);
+ }
}
for ( guint i = 0; i < G_N_ELEMENTS(verbsToUse); i++ ) {