From 8c545d7dfd8bea5f1776395826297ae2c6cb1433 Mon Sep 17 00:00:00 2001 From: mltownsend Date: Fri, 28 May 2010 21:17:32 +0000 Subject: Changed the SPUserManager instance to an allocated instance when the SPUserManager is selected. SPUserManager is released when the user his cancel or apply. This forces the UI to refresh itself. --- Source/SPDatabaseDocument.h | 2 +- Source/SPDatabaseDocument.m | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index ae92ec84..315b231c 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -54,7 +54,7 @@ IBOutlet id statusTableView; IBOutlet id statusTableCopyChecksum; - IBOutlet SPUserManager *userManagerInstance; + SPUserManager *userManagerInstance; IBOutlet NSSearchField *listFilterField; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 2120a85d..92f83a79 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -669,7 +669,7 @@ [tableDataInstance setConnection:mySQLConnection]; [extendedTableInfoInstance setConnection:mySQLConnection]; [databaseDataInstance setConnection:mySQLConnection]; - userManagerInstance.mySqlConnection = mySQLConnection; +// userManagerInstance.mySqlConnection = mySQLConnection; // Set the cutom query editor's MySQL version [customQueryInstance setMySQLversion:mySQLVersion]; @@ -2327,6 +2327,12 @@ */ - (IBAction)showUserManager:(id)sender { + if (!userManagerInstance) + { + userManagerInstance = [[SPUserManager alloc] init]; + userManagerInstance.mySqlConnection = mySQLConnection; + } + // Before displaying the user manager make sure the current user has access to the mysql.user table. MCPResult *result = [mySQLConnection queryString:@"SELECT * FROM `mysql`.`user` ORDER BY `user`"]; @@ -2347,11 +2353,16 @@ [NSApp beginSheet:[userManagerInstance window] modalForWindow:parentWindow - modalDelegate:userManagerInstance + modalDelegate:self didEndSelector:@selector(userManagerSheetDidEnd:returnCode:contextInfo:) contextInfo:nil]; } +- (void)userManagerSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void*)context +{ + [userManagerInstance release], userManagerInstance = nil; +} + /** * Passes query to tablesListInstance */ -- cgit v1.2.3