root/branches/Dirk_CPtr/Source/System/build.info

Revision 639, 1.1 kB (checked in by allenb, 2 years ago)

Fix a potential bug exposed by the memory checker code.

When writing test cases, I found a problem with with this code:

OSG::TransformNodePtr? xnode;
xnode = OSG::TransformNodePtr::create()

What hapens is:

~CoredNodePtr?() is called and calls setCore(NodeCorePtr?(NullFC)) which calls

setCore(cast_dynamic<CorePtr?>(pCore))

with a NULL pCore. The implementation of cast_dynamic calls getCPtr on the in parameter which in this case means it calls getElemP with a NULL fc.

The memory checker detects this case because it actually tries to use the cptr returned (instead of just casting it) and causes a seg fault. I think it seems like
a bad way for dynamic cast to behave so I added code that detects this case and just returns Null directly.

I fixed the code up by making cast_dynamic detect the case of a NULL fcptr and automatically return NULL instead of trying to do anything with the fc (such as
getCPtr()).

Note: I am not sure this is the "best" way to fix the problem, but it was the method that seemed to be the easiest to me.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 #!python
2 #
3 if option_pass:
4    print "Processing option pass"
5 else:
6    jpeg_option = opts.GetOption("jpeg")
7    tiff_option = opts.GetOption("tiff")
8    png_option = opts.GetOption("png")
9    glut_option = opts.GetOption("glut")
10    zlib_option = opts.GetOption("zlib")
11    
12    library = "OSGSystem"
13    osg_dep_libs = ['OSGBase']
14    
15    for option in [jpeg_option, tiff_option, png_option, zlib_option]:
16       if option.isAvailable():
17          libs.append(option.library)
18          if option.incDir:
19             cpppath.append(option.incDir)
20          if option.libDir:
21             libpath.append(option.libDir)
22
23    # Tests' dependencies
24    osg_test_libs = ['OSGBase', 'OSGSystem', 'OSGGroup' ]
25    test_cpppath = []
26    test_libpath = []
27      
28    for option in [glut_option]:
29       if option.isAvailable():
30          other_test_libs.append(option.library)
31          if option.incDir:
32             test_cpppath.append(option.incDir)
33          if option.libDir:
34             test_libpath.append(option.libDir)
35
36    if "darwin" == platform:
37       frameworks = ['OpenGL']
38       frameworkpath = []
Note: See TracBrowser for help on using the browser.