From 5fe06a08b068c69b18c8beb535a540558f612619 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 9 Jun 2001 00:24:25 +0000 Subject: [PATCH] fix multiple notify categories --- dtool/src/dconfig/notify.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/dtool/src/dconfig/notify.cxx b/dtool/src/dconfig/notify.cxx index 06def19c41..58c56f2df6 100644 --- a/dtool/src/dconfig/notify.cxx +++ b/dtool/src/dconfig/notify.cxx @@ -265,9 +265,19 @@ get_category(const string &basename, NotifyCategory *parent_category) { } } - NotifyCategory *category = - new NotifyCategory(fullname, basename, parent_category); - _categories.insert(Categories::value_type(fullname, category)); + pair result = + _categories.insert(Categories::value_type(fullname, NULL)); + + bool inserted = result.second; + NotifyCategory *&category = (*result.first).second; + + if (inserted) { + // If we just inserted a new record, then we have to create a new + // Category pointer. Otherwise, there was already one created + // from before. + category = new NotifyCategory(fullname, basename, parent_category); + } + return category; }