How's it possible that the following routine
printf's field containers with ref count 0 ?

Cheers,

   Toni

P.S.: Sorry for the formatting. The function just prints
the non null fs's with their respective refcount....


void printOSGInstances()
{
     Thread::getCurrent()->getChangeList()->clearAll();

     const std::vector<FieldContainerPtr> &fcs = 
*FieldContainerFactory::the()->getFieldContainerStore();

     int notNull = 0;
     for(int i=fcStoreSize;i<fcs.size();++i)
     {
         FieldContainerPtr fc = fcs[i];
         if(fc != NullFC)
         {
             notNull++;

             AttachmentContainerPtr ac = AttachmentContainerPtr::dcast(fc);

             if ( ac == NullFC )
             {
                 AttachmentPtr a = AttachmentPtr::dcast( fc );
                 if ( a != NullFC )
                 {
                     FieldContainerPtr dad = NullFC;

                     if ( a->getParents().size() > 0 )
                     {
                         dad = a->getParents().getValue(0);
                     }

                     ac = AttachmentContainerPtr::dcast(dad);
                 }
             }

             const osg::Char8 * name = OSG::getName( ac );

             if (  name != NULL )
             {
                 printf( "Detected live FC %s (%s) %p refcount %d!\n", 
fc->getTypeName(), name, fc.getCPtr(), fc.getRefCount());
             }
             else
             {
                 printf( "Detected live FC %s %p refcount %d!\n", 
fc->getTypeName(), fc.getCPtr(), fc.getRefCount() );
             }

                        SHLChunkPtr shader = SHLChunkPtr::dcast( fc );
                        if (shader!=NullFC)
                        {
                                printf( "-- vertex program: %s\n", 
shader->getVertexProgram().c_str() );
                                Zprintf( "-- fragment program: %s\n", 
shader->getFragmentProgram().c_str() );
                        }
         }
     }

        printf( "%d out of %d FC's are not destroyed\n", notNull, 
fcs.size()-fcStoreSize );

}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to