From b1a7fd93669ea72908848d2a2afb0fba6902660a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 10 Dec 2009 20:50:12 +0000 Subject: [PATCH] avoid double delete of UI objects caused by default behaviour of Glib::Private git-svn-id: svn://localhost/ardour2/branches/3.0@6341 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/pbd/ui_callback.h | 4 ++-- libs/pbd/ui_callback.cc | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libs/pbd/pbd/ui_callback.h b/libs/pbd/pbd/ui_callback.h index d5f4c51f4e..55691eb843 100644 --- a/libs/pbd/pbd/ui_callback.h +++ b/libs/pbd/pbd/ui_callback.h @@ -34,8 +34,8 @@ class UICallback virtual void call_slot (sigc::slot theSlot) = 0; - static UICallback* get_ui_for_thread() { return thread_ui.get(); } - static void set_ui_for_thread (UICallback* ui) { return thread_ui.set (ui); } + static UICallback* get_ui_for_thread(); + static void set_ui_for_thread (UICallback* ui); private: static Glib::StaticPrivate thread_ui; diff --git a/libs/pbd/ui_callback.cc b/libs/pbd/ui_callback.cc index 954d25f637..9a8feb3d2c 100644 --- a/libs/pbd/ui_callback.cc +++ b/libs/pbd/ui_callback.cc @@ -4,3 +4,16 @@ using namespace PBD; Glib::StaticPrivate UICallback::thread_ui; +static void do_not_delete_the_ui_pointer (void*) { } + +UICallback* +UICallback::get_ui_for_thread() { + return thread_ui.get (); +} + +void +UICallback::set_ui_for_thread (UICallback* ui) +{ + thread_ui.set (ui, do_not_delete_the_ui_pointer); +} +