[vtkusers] vtkCocoaRenderWindow bug?

Antoine Rosset rossetantoine at bluewin.ch
Fri Apr 4 17:49:39 EDT 2008


In 'vtkCocoaRenderWindow::vtkCocoaRenderWindow()' you create a  
CocoaManager variable with a NSMutableDictionary. This variable is  
created as an autorelease object : that means that this object is not  
retained and can be released by the OS when it quits the function  
(during the next runloop).

In my opinion, it should be

this->SetCocoaManager(reinterpret_cast<void *>( [[NSMutableDictionary  
dictionary] retain]));
instead of
this->SetCocoaManager(reinterpret_cast<void *>( [NSMutableDictionary  
dictionary]));

and then in the destructor

// Release the cocoa object manager.
NSMutableDictionary* manager = reinterpret_cast<NSMutableDictionary  
*>(this->GetCocoaManager());
[manager release];
this->SetCocoaManager(NULL);

What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080404/dbf1de5a/attachment.htm>


More information about the vtkusers mailing list