diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2012-01-01 11:45:32 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2012-01-01 11:45:32 +0000 |
| commit | 8efbe2cbb9cda49278ec57c21551f943c7033fa4 (patch) | |
| tree | 41e32ba9c6a874af9d6d4fc5b9b71948b91469d1 /src/widgets/toolbox.cpp | |
| parent | Fix for Bug #494722 (Docked dialogs in a floating window crashes on shutdown)... (diff) | |
| download | inkscape-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.cpp | 16 |
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++ ) { |
