bug 952928 - Ensure an autorelease pool is in place in InitializeVersionNumbers() before calling Cocoa APIs. r=benwa

This commit is contained in:
Jonathan Kew 2013-12-29 11:32:02 +00:00
parent fca94d9b16
commit b1c89a165f

View File

@ -12,6 +12,7 @@
// This API will not work for OS X 10.10, see Gestalt.h. // This API will not work for OS X 10.10, see Gestalt.h.
#include "nsCocoaFeatures.h" #include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
#include "nsDebug.h" #include "nsDebug.h"
#include "nsObjCExceptions.h" #include "nsObjCExceptions.h"
@ -51,6 +52,10 @@ nsCocoaFeatures::InitializeVersionNumbers()
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK; NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
// Provide an autorelease pool to avoid leaking Cocoa objects,
// as this gets called before the main autorelease pool is in place.
nsAutoreleasePool localPool;
int major, minor, bugfix; int major, minor, bugfix;
GetSystemVersion(major, minor, bugfix); GetSystemVersion(major, minor, bugfix);