From e1dc2d46042af61ae045eb49568e9284453c9e12 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 16 Nov 2015 21:23:39 -0500 Subject: correct value testing for Stateful thread-private variable controlling ID regeneration --- libs/pbd/stateful.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libs/pbd/stateful.cc') diff --git a/libs/pbd/stateful.cc b/libs/pbd/stateful.cc index 628594891b..92314e1e53 100644 --- a/libs/pbd/stateful.cc +++ b/libs/pbd/stateful.cc @@ -44,9 +44,9 @@ namespace PBD { int Stateful::current_state_version = 0; int Stateful::loading_state_version = 0; -static void do_not_delete (void*) { } +static void regular_delete (void* p) { bool* bp = reinterpret_cast (p); delete bp; std::cerr << "Deleted RSSI bool\n"; } -Glib::Threads::Private Stateful::regenerate_xml_or_string_ids (do_not_delete); +Glib::Threads::Private Stateful::regenerate_xml_or_string_ids (regular_delete); Stateful::Stateful () : _extra_xml (0) @@ -385,8 +385,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,7 +409,9 @@ 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; -- cgit v1.2.3