Hi Dirk!
> Well, we somewhat on purpose decided to not allow that, as it lends
> itself to code like "while(refcnt > 0) subRef();", which would wrack
> havoc on multi-threaded apps. It is a case of trying to not let the
> users shoot themselves in the foot and entice them to do their ref
> counting cleanly, but it does have problems for debugging.
>
> However, for debugging I'd recommend one of the best kept open secrets
> of OpenSG: the WebInterface. Take a look at
> Source/Experimental/WebInterface. It allows you to look under the covers
> of a running application, including scene graph and ChangeList.
Ok, will look at that.
> If that doesn't help you we can try convincing Gerrit that access to the
> ref count is not as bad as he thinks it is. ;)
I understand the reason, but if you think you can prevent users from writing
ugly code or shooting themselves in the foot....think again, or see below :)
I wrote my own getRefCount. Now it is up to you to decide if we(the users)
should use this method or if you should add a public getRefCount method. ;)
void LogCallback(const char *pszText, int size, void *pData)
{
int rc;
const char *pTmp = pszText;
while(*pTmp == ' ')
pTmp++;
int r = sscanf(pTmp, "RefCount : %x", &rc);
if(r == 1)
{
*((int *)pData) = rc;
}
}
int getRefCount(OSG::FieldContainerPtr &fc)
{
int refCount = 0;
if(fc != NullFC)
{
LogBuf &lb = osgLog().getLogBuf();
lb.setCallback(LogCallback, &refCount, true);
LogType lt = osgLog().getLogType();
osgLog().setLogType(OSG::LOG_BUFFER);
fc.dump(0, OSG::FCDumpFlags::RefCount);
lb.removeCallback();
osgLog().setLogType(lt);
}
return refCount;
}
Regards
Fredrik
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users