Hi Rick,
On Wed, Nov 26, 2008 at 8:06 AM, Rick Appleton
<[EMAIL PROTECTED]> wrote:
> I can confirm that enabling Registry caching of images with paged databases
> causes the issue. We haven't tried to disable the caching, but from what I've
> seen I believe that if the cache is disabled the same issue *may* occur but
> even earlier, precisely becaue an undecorated Image* is returned. The
> ReadResult eventually goes out of scope, which should delete the pointed to
> memory, causing a dangling pointer to exist. (Note that I haven't tried this,
> it's purely my understanding of the issue).
The ReadResult doesn't delete the object which it goes out of scope
because normally the object is taken from the RedResult. The code for
readImageFile looks like:
Image* osgDB::readImageFile(const std::string& filename,const
ReaderWriter::Options* options)
{
ReaderWriter::ReadResult rr =
Registry::instance()->readImage(filename,options);
if (rr.validImage()) return rr.takeImage();
if (rr.error()) notify(WARN) << rr.message() << std::endl;
return NULL;
}
The takeImage uses ref_ptr<> release that decrements the ref count of
the object by 1 without deleting it if the count goes to 0.
It does mean the ref count is now 0 on return from readImageFile(),
unless it's cached in which case the ref count will be 1, but if the
object cache is cleared in the meantime before the image is reassigned
then it could potentially be deleted prior to reassignment. This
issue will only happen if the object cache is used in Registry. Which
I asked for clarification about when the problem occurs.
So can please disable the cache and then see if you can reproduce the
issue. It is crucial for confirming this issue.
Also could you not post emails that piggy back of digest posts as it
totally messes up any threading in people mail clients and in the
archives - you've effectively broken this thread in half so others
trying to follow it will look at the first half and find it just going
dead. Knowing that the same thread appears under a completely
misleading subject line would require some kind of divine help.
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org