Hi Barker,

I've had a quick look at Input.cpp and all the read file calls use C
pointers which won't be safe when an application is running multi-threading
loads and using the pruning cache at the same time. Temporary workarounds I
can see would be either not use object cache when multti-threading load,
not use the deprecated .osg format for loading files or to simply run these
loads synchronously.

The proper fix would be to make sure Input.cpp and the deprecated wrappers
all use ref_ptr<> for the data they use.  Unfortunately this will break the
ABI of osgDB so would push the fix out beyond OSG-3.2.  I'd welcome a
submission that addresses this issue with the deprecated loading code.

Cheers,
Robert.


On 21 November 2013 17:07, Bradley Baker Searles <bakersear...@gmail.com>wrote:

> Hi Robert,
>
> The DatabasePager calls using ReadResult all use a ref_ptr<osg::Object> to
> store the loaded item, unlike the code in
> src/osgwrappers/deprecated-dotosg/osg/texture2d.cpp ::
> Texture2D_readLocalData(Object, Input), which uses
> Input::ReadImage(filename) to load the image.
>
> Input::ReadImage() calls osgDB::readImageFile() which loads the image via
> the Registry (which keeps a reference), then violates the ref_ptr<> to
> return a raw pointer. This code is not thread safe. If a render happens
> before this raw pointer is safely tucked into a ref_ptr<>, the asset is
> deleted as described previously which makes the raw pointer junk.
>
> This crash is happening deep within OSG code paths on both threads. Our
> app isn't affecting anything but the timing here.
>
> Is there any reason I should not submit a patch to the OSG that uses
> thread-safe ref_ptr<>'s for any load path that uses the Registry Object
> Cache to load assets?
>
> Thanks,
> Baker
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57370#57370
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to