Hi Anthony,

I've just looked at the code an believe I understand the failure path
your describing, and your fix looks like it will address the problem.
Like you am I left wondering if this quick fix is a complete solution
so will need to think some more about the topic before commit a fix.

Robert.

On 2 November 2011 06:19, I-Nixon, Anthony D <[email protected]> wrote:
> Hi Guys:
>
>
>
> I’ve found a problem when upgrading our application to 3.0.1 (from 2.8)
> whereby files (fonts, models, etc) fail to load *after* an archive has been
> loaded.  If no archive has been loaded, everything is fine.
>
>
>
> The offending code appears to be this in Registry::read() added at rev
> 12638:
>
>
>
>     // check loaded archives.
>
>     AvailableArchiveIterator aaitr(_archiveCache, _archiveCacheMutex);
>
>     for(;aaitr.valid();++aaitr)
>
>     {
>
>         ReaderWriter::ReadResult rr = readFunctor.doRead(*aaitr);
>
>         if (readFunctor.isValid(rr)) return rr;
>
>         else results.push_back(rr);
>
>     }
>
>
>
> If an archive has been loaded, this code causes FILE_NOT_FOUND to be pushed
> onto the results vector if the file being loaded is not part of the
> archive.  This causes the function to exit later before any other (currently
> not loaded) plugins get a chance at loading the file.
>
>
>
> Making the following change fixes the issue for me, but it may be a bit
> naive?
>
>
>
>     // check loaded archives.
>
>     AvailableArchiveIterator aaitr(_archiveCache, _archiveCacheMutex);
>
>     for(;aaitr.valid();++aaitr)
>
>     {
>
>         ReaderWriter::ReadResult rr = readFunctor.doRead(*aaitr);
>
>         if (readFunctor.isValid(rr)) return rr;
>
>         else if (rr.status() != ReaderWriter::ReadResult::FILE_NOT_FOUND)
> results.push_back(rr);
>
>     }
>
>
>
> A small test program reproduces the problem:
>
>
>
> int main(int arg, char* argv[])
>
> {
>
>      osg::Node* pNode1 = osgDB::readNodeFile(“a path to a .osga”);
>
>      osg::Node* pNode2 = osgDB::readNodeFile(“a path to a .flt”);// Needs to
> be a file type that is not contained in the archive
>
>      return 0;
>
> }
>
>
>
> Given the above, pNode2 will be null ... reverse the order of the two lines
> and pNode1 and pNode2 will be valid.
>
>
>
> Cheers
>
>
>
> Anthony
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to