Hi Antonio,

> Hi Andreas,
> 
> 
> 
>>Hi Antonio,
>>
>>
>>>Hello,
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>I'm trying to make my application "crash save". As
>>>>you might know, the loader sometimes crashes when
>>>>loading corrupt files or it sometimes just happens
>>>>with obj or 3ds files. So I tried to wrap all the
>>>>loader stuff in try catch statements, but they
>>>>didn't help either. As I'm not a try-catch guru,
>>>>I don't really know what's happening. Some reading
>>>>on google suggests me that it might also depend on
>>>>how the lib/app was compiled. Has anybody here a
>>>>deeper insight about the issue? I just would like
>>>>to avoid those hard crashes..... (BTW, I'm talking
>>>>about windows...).
>>>
>>>
>>>I tried to debug the application and here's what
>>>I found:
>>>
>>>The loader crashes in osgsimplescenemanager.cpp
>>>in the method "readProgress(void * OSG_CHECK_ARG(data))"
>>>
>>>The funny thing is that there's somehow a race condition,
>>>if I set a breakpoint and step through the method it does
>>>not crash, if I don't set a breakpoint it does! Also disabling
>>>the setReadProgressCB in my application resolves the problem.
>>>
>>>Perhaps the input stream is closed and removed while the
>>>readProgress thread is sleeping in it's while loop?
>>>
>>>I am loading an obj file with "Invalid d entry in blabla.mtl"
>>>
>>>Any ideas?
>>
>>yes the threading code is a bit unsafe. You should add the callback via
>>setReadProgressCB(progress, false) this won't create a extra thread but
>>it is not implemented for all loaders yet only for osb and wrl. I can
>>implement the remaining loaders on friday.
> 
> 
> As a workaround the "false" flag works ok also with obj files.
> Thank you!
> 
> While playing with the loader I made two observations:
> 
> When I use the standard loader interface that uses the filename
> and load an obj, on some obj files I get an error.
> If I instead use the ifstream version and pass him the format
> to read, it loads! Here's the code I tested with:
> 
> try{
>   m_pNode = OSG::NullFC;
>   OSG::SceneFileType *st = osg::SceneFileHandler::the().getFileType(
> m_sPath.toStdString().c_str() );
> 
>   if( st ){
>     std::ifstream infile;
> 
>     infile.open (m_sPath.toStdString().c_str(), std::ios::binary);
>     char nm[16], dummyStr[1024];
>     sscanf( st->getName(), "%s %s", nm, dummyStr ); // get extension
>     m_pNode = osg::SceneFileHandler::the().read(infile, nm, graphOperator);
>     infile.close();
>   }
> }catch( ...){
>   printf( "exception!\n" );
>   m_pNode = OSG::NullFC;
> }

shouldn't make a difference, what error did you get do you have a 
example file. Hmm looks quite complicated what about this ...

std::ifstream infile;
infile.open(m_sPath.toStdString().c_str(), std::ios::binary);
if(infile)
{
        m_pNode = osg::SceneFileHandler::the().read(infile, 
m_sPath.toStdString().c_str(), graphOperator);
}

Andreas

> 
> A second observation is that some 3ds files cause the loader to run
> into an endless loop.... (?) Will look into it...
> 
> 
> Regards,
> 
>   Toni
> 
> 
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to