We discovered this morning (almost by accident) that the gcc setting
GCC_OBJC_CALL_CXX_CDTORS has been enabled for us since our switch to
4.2 last summer. This means that destructors on C++ objects will be
called when the objective-c object containing it goes away (this
wasn't the case with past Objective-C runtimes). I am about to check
in a CL that makes it explicit across our xcode configs so we don't
repeat the argument Mark and I had this morning :-)

This means that we are now free to use scoped_ptr<>, scoped_array<>,
scoped_nsobject<>, etc in our @interfaces to syntactically identify
strong references and prevent memory leaks due to programmer error. I
encourage people to use these in their code, and fix them when they
run across strong references that would benefit from a simple
conversion. I converted BrowserWindowController and verified that
indeed both dtors and deallocs are correctly called. It took like 2
minutes.

Let me know if you have any questions, and be sure to remind your
fellow coders about these classes when doing code reviews.

-- 
Mike Pinkerton
Mac Weenie
[email protected]

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: [email protected] 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to