From b1c89a165f27150f598809f1784f256e90c0dff0 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Sun, 29 Dec 2013 11:32:02 +0000 Subject: [PATCH] bug 952928 - Ensure an autorelease pool is in place in InitializeVersionNumbers() before calling Cocoa APIs. r=benwa --- widget/cocoa/nsCocoaFeatures.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm index c9ab839ea509..f52a3df4f4ca 100644 --- a/widget/cocoa/nsCocoaFeatures.mm +++ b/widget/cocoa/nsCocoaFeatures.mm @@ -12,6 +12,7 @@ // This API will not work for OS X 10.10, see Gestalt.h. #include "nsCocoaFeatures.h" +#include "nsCocoaUtils.h" #include "nsDebug.h" #include "nsObjCExceptions.h" @@ -51,6 +52,10 @@ nsCocoaFeatures::InitializeVersionNumbers() { 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; GetSystemVersion(major, minor, bugfix);