diff --git a/synfig-studio/src/gui/canvasview.cpp b/synfig-studio/src/gui/canvasview.cpp index 3904e3e..cb55c91 100644 --- a/synfig-studio/src/gui/canvasview.cpp +++ b/synfig-studio/src/gui/canvasview.cpp @@ -868,7 +868,13 @@ CanvasView::~CanvasView() App::dock_manager->unregister_dockable(*this); signal_deleted()(); - App::ui_manager()->remove_action_group(action_group); + // I didn't find a proper way to check if actiongroup is already removed on CanvasView::deactivate + // So here is a quick-hack. This error is mostly invisible because it fails on App exiting + // but i didn't think it worth to spend time to it, because remove_action_group is deprecated + // and this code is required to rewrite. + + if (!this->_action_group_removed) + App::ui_manager()->remove_action_group(action_group); // Shut down the smach smach_.egress(); @@ -909,6 +915,7 @@ void CanvasView::activate() activation_index_.activate(); get_smach().process_event(EVENT_REFRESH_TOOL_OPTIONS); App::ui_manager()->insert_action_group(action_group); + this->_action_group_removed = false; update_title(); present(); } @@ -917,6 +924,7 @@ void CanvasView::deactivate() { get_smach().process_event(EVENT_YIELD_TOOL_OPTIONS); App::ui_manager()->remove_action_group(action_group); + this->_action_group_removed = true; update_title(); } diff --git a/synfig-studio/src/gui/canvasview.h b/synfig-studio/src/gui/canvasview.h index a0573ba..97e97ee 100644 --- a/synfig-studio/src/gui/canvasview.h +++ b/synfig-studio/src/gui/canvasview.h @@ -409,6 +409,7 @@ private: Gtk::RadioButtonGroup low_res_pixel_size_group; Glib::RefPtr action_group; + bool _action_group_removed; etl::handle ui_interface_; etl::handle selection_manager_; diff --git a/synfig-studio/src/gui/docks/dockbook.cpp b/synfig-studio/src/gui/docks/dockbook.cpp index 9440c04..0537d1a 100644 --- a/synfig-studio/src/gui/docks/dockbook.cpp +++ b/synfig-studio/src/gui/docks/dockbook.cpp @@ -87,15 +87,30 @@ DockBook::DockBook(): DockBook::~DockBook() { - DockManager::containers_to_remove_.erase(this); deleting_=true; clear(); + DockManager::containers_to_remove_.erase(this); } void DockBook::clear() { - while(get_n_pages()) + // here the point: get_n_pages is fails because this is not notebook type + // i didn't know why this happens, possibly because clear() is called from destructor + // and 'this' is already deleted. Or, this function maybe never work right. + // So here quick-hack again. Btw, as you can see from commented code later newly created + // dockbook is works fine, so this situation is reqired more detailed investigation. + if (!GTK_IS_NOTEBOOK (this)) return; // because we always fail if 'this' is not notebook + + /*Gtk::Notebook note; + int x = note.get_n_pages(); + + DockBook db; + x = db.get_n_pages(); + + const Gtk::Notebook* nb = (const Gtk::Notebook*)this;*/ + //assert(GTK_IS_NOTEBOOK (nb)); + while (this->get_n_pages()) remove(static_cast(*get_nth_page(get_n_pages()-1))); }