Avoid recreating the BookmarksManager (and hence PreferencesManager) on quit if we haven't created one yet; this could happen when launching with another copy of Camino running.

This commit is contained in:
smfr%smfr.org 2005-10-17 16:36:16 +00:00
parent ddd7501923
commit 90300c5a7f
4 changed files with 27 additions and 16 deletions

View File

@ -354,16 +354,17 @@ const int kReuseWindowOnAE = 2;
[NetworkServices shutdownNetworkServices];
[[BookmarkManager sharedBookmarkManager] shutdown];
// make sure the info window is closed
[BookmarkInfoController closeBookmarkInfoController];
// shut down bookmarks (if we made them)
[[BookmarkManager sharedBookmarkManagerDontCreate] shutdown];
// Autosave one of the windows.
[[[mApplication mainWindow] windowController] autosaveWindowFrame];
// Cancel outstanding site icon loads
[[RemoteDataProvider sharedRemoteDataProvider] cancelOutstandingRequests];
// make sure the info window is closed
[BookmarkInfoController closeBookmarkInfoController];
// Release before calling TermEmbedding since we need to access XPCOM
// to save preferences

View File

@ -57,20 +57,20 @@
@implementation BookmarkInfoController
/* BookmarkInfoController singelton */
static BookmarkInfoController *sharedBookmarkInfoController = nil;
static BookmarkInfoController* gSharedBookmarkInfoController = nil;
+ (id)sharedBookmarkInfoController
{
if (!sharedBookmarkInfoController) {
sharedBookmarkInfoController = [[BookmarkInfoController alloc] initWithWindowNibName:@"BookmarkInfoPanel"];
if (!gSharedBookmarkInfoController) {
gSharedBookmarkInfoController = [[BookmarkInfoController alloc] initWithWindowNibName:@"BookmarkInfoPanel"];
}
return sharedBookmarkInfoController;
return gSharedBookmarkInfoController;
}
+ (void)closeBookmarkInfoController
{
if (sharedBookmarkInfoController)
[sharedBookmarkInfoController close];
if (gSharedBookmarkInfoController)
[gSharedBookmarkInfoController close];
}
- (id)initWithWindowNibName:(NSString *)windowNibName
@ -101,8 +101,8 @@ static BookmarkInfoController *sharedBookmarkInfoController = nil;
-(void)dealloc
{
// this is never called
if (self == sharedBookmarkInfoController)
sharedBookmarkInfoController = nil;
if (self == gSharedBookmarkInfoController)
gSharedBookmarkInfoController = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[mBookmarkItem release];

View File

@ -77,6 +77,7 @@ extern NSString* const kBookmarksMenuFolderIdentifier;
// Class Methods & shutdown stuff
+ (BookmarkManager*)sharedBookmarkManager;
+ (BookmarkManager*)sharedBookmarkManagerDontCreate;
- (void)loadBookmarksLoadingSynchronously:(BOOL)loadSync;

View File

@ -127,13 +127,19 @@ enum {
static NSString* const kWriteBookmarkNotification = @"write_bms";
static BookmarkManager* gBookmarkManager = nil;
+ (BookmarkManager*)sharedBookmarkManager
{
static BookmarkManager* sBookmarkManager = nil;
if (!sBookmarkManager)
sBookmarkManager = [[BookmarkManager alloc] init];
if (!gBookmarkManager)
gBookmarkManager = [[BookmarkManager alloc] init];
return sBookmarkManager;
return gBookmarkManager;
}
+ (BookmarkManager*)sharedBookmarkManagerDontCreate
{
return gBookmarkManager;
}
// serialize to an array of UUIDs
@ -209,6 +215,9 @@ static NSString* const kWriteBookmarkNotification = @"write_bms";
-(void) dealloc
{
if (gBookmarkManager == self)
gBookmarkManager = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[mTop10Container release];