From e6559af28325dce07c968fd3910bc44026d30726 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 4 Oct 2010 11:29:39 +0000 Subject: [PATCH] From Stephan Huber, "just a follow-up: I looked at the code of osg/Referenced.cpp and notice a discrepancy in getOrCreateObserverSet. For the atomic- and mutex-codepaths the newly created observerset gets manually ref'ed, but not in the codepath used when OPENTHREADS_ATOMIC_USE_MUTEX is defined. I added the manual ref and tadaaa, the crash went away." --- src/osg/Referenced.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/osg/Referenced.cpp b/src/osg/Referenced.cpp index 7e59d6046..520759027 100644 --- a/src/osg/Referenced.cpp +++ b/src/osg/Referenced.cpp @@ -282,7 +282,11 @@ ObserverSet* Referenced::getOrCreateObserverSet() const } else { - if (!_observerSet) _observerSet = new ObserverSet(this); + if (!_observerSet) + { + _observerSet = new ObserverSet(this); + static_cast(_observerSet)->ref(); + } return static_cast(_observerSet); } #endif