X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fstateful.cc;h=8b8219f7e2243306f201f95257b035ec20b18cf0;hb=cf52d6e4b40111eb04b244ec054055a4ec15dbe0;hp=628594891bbb87de105bc646fad081072715de60;hpb=92fe47bdeec3864d69c10b538851d1f7f0cceaaf;p=ardour.git diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 628594891b..8b8219f7e2 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -35,7 +35,7 @@ #include "pbd/xml++.h" #include "pbd/error.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; @@ -44,9 +44,7 @@ namespace PBD { int Stateful::current_state_version = 0; int Stateful::loading_state_version = 0; -static void do_not_delete (void*) { } - -Glib::Threads::Private Stateful::regenerate_xml_or_string_ids (do_not_delete); +Glib::Threads::Private Stateful::_regenerate_xml_or_string_ids; Stateful::Stateful () : _extra_xml (0) @@ -385,8 +383,9 @@ bool Stateful::set_id (const XMLNode& node) { const XMLProperty* prop; + bool* regen = _regenerate_xml_or_string_ids.get(); - if (regenerate_xml_or_string_ids.get()) { + if (regen && *regen) { reset_id (); return true; } @@ -408,17 +407,31 @@ Stateful::reset_id () void Stateful::set_id (const string& str) { - if (regenerate_xml_or_string_ids.get()) { + bool* regen = _regenerate_xml_or_string_ids.get(); + + if (regen && *regen) { reset_id (); } else { _id = str; } } +bool +Stateful::regenerate_xml_or_string_ids () const +{ + bool* regen = _regenerate_xml_or_string_ids.get(); + if (regen && *regen) { + return true; + } else { + return false; + } +} + void Stateful::set_regenerate_xml_and_string_ids_in_this_thread (bool yn) { - regenerate_xml_or_string_ids.set (&yn); + bool* val = new bool (yn); + _regenerate_xml_or_string_ids.set (val); } } // namespace PBD