[vtkusers] vtkCocoaRenderWindow bug?

Sean McBride sean at rogue-research.com
Fri Apr 4 19:35:02 EDT 2008


On 4/4/08 11:49 PM, Antoine Rosset said:

>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?

Look at the implementation of SetCocoaManager() itself, it does the
retain and release.  Is this code giving you problems?  Or did it just
look weird on inspection?

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada




More information about the vtkusers mailing list