Show
Ignore:
Timestamp:
02/18/08 14:52:26 (7 years ago)
Author:
robert
Message:

From Brede Johansen, "Here's a fix to the changes regarding the new dispose() function. The
last primary node inside a push-pop level would not get the dispose()
call. This would result in information from some ancillary records,
like the matrix (transform), being lost.

Changes are made to the latest version in the repository.

Thanks to Terry for the help to find and fix the bug and test the changes."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/OpenFlight/ControlRecords.cpp

    r7756 r7859  
    6464        virtual void read(RecordInputStream& /*in*/, Document& document) 
    6565        { 
    66             // Finally call dispose() for primary with push, pop level pair.  
    67             PrimaryRecord* primary = document.getTopOfLevelStack(); 
    68             if (primary) 
     66            PrimaryRecord* parentPrimary = document.getTopOfLevelStack(); 
     67            PrimaryRecord* currentPrimary = document.getCurrentPrimaryRecord(); 
     68 
     69            // Call dispose() for primary without push, pop level pair.  
     70            if (currentPrimary && currentPrimary!=parentPrimary) 
    6971            { 
    70                 primary->dispose(document); 
     72                currentPrimary->dispose(document); 
    7173            } 
    7274 
     75            // Call dispose() for primary with push, pop level pair.  
     76            if (parentPrimary) 
     77            { 
     78                parentPrimary->dispose(document); 
     79            } 
     80 
    7381            document.popLevel(); 
    7482        }