diff --git a/camino/PreferencePanes/WebFeatures/WebFeatures.h b/camino/PreferencePanes/WebFeatures/WebFeatures.h index 46d1e0fd82e5..8e0e1d7dba79 100644 --- a/camino/PreferencePanes/WebFeatures/WebFeatures.h +++ b/camino/PreferencePanes/WebFeatures/WebFeatures.h @@ -1,3 +1,27 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +* +* The contents of this file are subject to the Mozilla Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/MPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is the Mozilla browser. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 2002 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +* william@dell.wisner.name (William Dell Wisner) +* joshmoz@gmail.com (Josh Aas) +*/ + #import #import #import "PreferencePaneBase.h" diff --git a/camino/PreferencePanes/WebFeatures/WebFeatures.mm b/camino/PreferencePanes/WebFeatures/WebFeatures.mm index 4b51f01afef8..bb63ec46eae6 100644 --- a/camino/PreferencePanes/WebFeatures/WebFeatures.mm +++ b/camino/PreferencePanes/WebFeatures/WebFeatures.mm @@ -1,3 +1,27 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- +* +* The contents of this file are subject to the Mozilla Public +* License Version 1.1 (the "License"); you may not use this file +* except in compliance with the License. You may obtain a copy of +* the License at http://www.mozilla.org/MPL/ +* +* Software distributed under the License is distributed on an "AS +* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +* implied. See the License for the specific language governing +* rights and limitations under the License. +* +* The Original Code is the Mozilla browser. +* +* The Initial Developer of the Original Code is Netscape +* Communications Corporation. Portions created by Netscape are +* Copyright (C) 2002 Netscape Communications Corporation. All +* Rights Reserved. +* +* Contributor(s): +* william@dell.wisner.name (William Dell Wisner) +* joshmoz@gmail.com (Josh Aas) +*/ + #import "WebFeatures.h" #import "NSString+Utils.h" @@ -10,20 +34,39 @@ #include "nsIURI.h" #include "nsNetUtil.h" +// we should really get this from "CHBrowserService.h", +// but that requires linkage and extra search paths. +static NSString* XPCOMShutDownNotificationName = @"XPCOMShutDown"; + @implementation OrgMozillaChimeraPreferenceWebFeatures - (void) dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + NS_IF_RELEASE(mManager); [super dealloc]; } +- (void)xpcomShutdown:(NSNotification*)notification +{ + // this nulls the pointer + NS_IF_RELEASE(mManager); +} - (void)mainViewDidLoad { - if ( !mPrefService ) + if (!mPrefService) return; + // we need to register for xpcom shutdown so that we can clear the + // services before XPCOM is shut down. We can't rely on dealloc, + // because we don't know when it will get called (we might be autoreleased). + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(xpcomShutdown:) + name:XPCOMShutDownNotificationName + object:nil]; + BOOL gotPref = NO; // Set initial value on Java/JavaScript checkboxes