HI Nick,

Thanks for spotting this bug.  Your fix wasn't actually thread safe,
what was missing was the assignment of the _ptr after the
ObserverMutex was acquired. the code should have been:

        observer_ptr(const observer_ptr& rp)
        {
            OpenThreads::ScopedLock<OpenThreads::Mutex>
lock(*getObserverMutex());
            _ptr = rp._ptr;
            if (_ptr) _ptr->addObserver(this);
        }

I've just checked this in.  Could you check that this works with osgWidget.

Cheers,
Robert.


On Mon, Feb 22, 2010 at 8:23 AM, Trajce (Nick) Nikolov
<[email protected]> wrote:
> Hi Robert,
> here is a fix for osgWidget (and some other I believe)
> I changed
> observer_ptr(const observer_ptr& rp): _ptr(0L)
> to
> observer_ptr(const observer_ptr& rp): _ptr(rp._ptr)
> Cheers,
> -Nick
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to