Fix a crash on quit that happened if you had visited the Web Features pref panel. It occurred because we assumed that -dealloc would be called before XPXCOM shutdown, which is not true of autoreleased objects. This is the same fix for the same bug that smfr committed yesterday in the privacy pref pane code. Also, add licenses to two files missing them.

This commit is contained in:
joshmoz%gmail.com 2005-01-19 02:14:21 +00:00
parent 308c16c134
commit 65c3b4c8f8
2 changed files with 68 additions and 1 deletions

View File

@ -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 <Cocoa/Cocoa.h>
#import <PreferencePanes/NSPreferencePane.h>
#import "PreferencePaneBase.h"

View File

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