[osg-users] osgText crash with multiple Viewers

Ravi Mathur ravidavi at utexas.edu
Tue Dec 18 11:28:14 PST 2018

Hi Robert, yes I'm working on a standalone test program now. Multithreaded
crashes are often hard to reproduce in a vacuum, but as soon as I have
something I'll post here.

I'm running on Win10, Nvidia GTX 980 (latest drivers), Visual Studio 2013,
OpenSceneGraph-3.6 branch.


On Tue, Dec 18, 2018 at 4:24 AM Robert Osfield <robert.osfield at gmail.com>

> Hi Ravi,
> My guess is that the new text implementation isn't the cause of the crash,
> only it's the straw that broke the camels back, and actually there is an
> underlying limitation with the OSG w..r.t you specific usage case.
> Could you create a small test program that reproduces the crash.  Details
> on your OS/dev tools/hardware will be useful too.
> Cheers.
> Robert.
> On Tue, 18 Dec 2018 at 08:50, Ravi Mathur <ravidavi at utexas.edu> wrote:
>> Hello all,
>> I'm seeing a crash on the OpenSceneGraph-3.6 branch that occurs when I
>> have two CompositeViewers that contain Text objects in their scenes. My
>> simplified scenario is this:
>> - 2 CompositeViewers, each in singlethreaded mode, but being run at the
>> same time in separate threads (via OpenThreads::Thread wrappers)
>> - The viewers do not share scenes or contexts, and each has a single Text
>> object as its scene
>> - Each viewer is destroyed immediately after its run() loop returns
>> (needed for my application)
>> Both viewers animate just fine in their own windows. The crash happens if
>> one viewer is being destroyed while the other is actively rendering. Note
>> that it only seems to crash if there are Text objects in each scene, and
>> did not crash with the old (pre-3.6) Text implementation.
>> Is this usage model ok in the first place? Robert, I read your post in
>> this recent thread
>> <http://forum.openscenegraph.org/viewtopic.php?t=16844> in which you
>> advise against manually destroying viewers. Should I assume that I was just
>> lucky in getting away with this until now? The new Text implementation
>> seems to be the only thing that triggers the crash.
>> In case anybody is interested, the crash happens due to this sequence of
>> calls:
>> - ~CompositeViewer() calls GraphicsContext::close(), which deletes its
>> State
>> - ~CompositeViewer() then destroys its osgViewer::View, which in turn
>> destroys its Camera
>> - ~Camera() eventually calls osgText::releaseGLObjects() with a null
>> State.
>> - osgText::releaseGLObjects(null) deletes text-related objects (Programs)
>> on ALL contexts
>> - The other CompositeViewer, which is actively rendering its Text on
>> another context, crashes with an access violation since its Text-related
>> Programs were just deleted.
>> Thanks,
>> Ravi
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20181218/f8aaf2e1/attachment.html>

More information about the osg-users mailing list