aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseDocument.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-29 21:25:52 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-29 21:25:52 +0000
commitc1cb48f6afa93b8ed26baa434d66d1ca3e0afca7 (patch)
treef3b1a2864fbead4c7810303eb60b83b2457d677e /Source/SPDatabaseDocument.m
parentcef5a0200f433e53bd27b2516e5ac269205f0420 (diff)
downloadsequelpro-c1cb48f6afa93b8ed26baa434d66d1ca3e0afca7.tar.gz
sequelpro-c1cb48f6afa93b8ed26baa434d66d1ca3e0afca7.tar.bz2
sequelpro-c1cb48f6afa93b8ed26baa434d66d1ca3e0afca7.zip
• Bundle commands
- register running commands for each SPDatabaseDocument or if the command runs via 'General' for NSApp delegate - kill all running commands before SP will be terminated
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r--Source/SPDatabaseDocument.m26
1 files changed, 25 insertions, 1 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 4b52b39d..23805b12 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -116,6 +116,7 @@
spfSession = nil;
spfPreferences = [[NSMutableDictionary alloc] init];
spfDocData = [[NSMutableDictionary alloc] init];
+ runningBASHprocesses = [[NSMutableArray alloc] init];
titleAccessoryView = nil;
taskProgressWindow = nil;
@@ -2400,6 +2401,7 @@
*/
- (void)applicationWillTerminate:(NSNotification *)notification
{
+
// Auto-save preferences to spf file based connection
if([self fileURL] && [[[self fileURL] path] length] && ![self isUntitled])
if(_isConnected && ![self saveDocumentWithFilePath:nil inBackground:YES onlyPreferences:YES contextInfo:nil]) {
@@ -2408,7 +2410,7 @@
}
[tablesListInstance selectionShouldChangeInTableView:nil];
-
+
// Note that this call does not need to be removed in release builds as leaks analysis output is only
// dumped if [[SPLogger logger] setDumpLeaksOnTermination]; has been called first.
[[SPLogger logger] dumpLeaks];
@@ -4738,6 +4740,26 @@
NSLog(@"received: %@", commandDict);
}
+- (void)registerBASHCommand:(NSDictionary*)commandDict
+{
+ [runningBASHprocesses addObject:commandDict];
+}
+
+- (void)unRegisterBASHCommand:(NSInteger)pid
+{
+ for(id cmd in runningBASHprocesses) {
+ if([[cmd objectForKey:@"pid"] integerValue] == pid) {
+ [runningBASHprocesses removeObject:cmd];
+ break;
+ }
+ }
+}
+
+- (NSArray*)runningBASHProcesses
+{
+ return (NSArray*)runningBASHprocesses;
+}
+
- (NSDictionary*)shellVariables
{
NSMutableDictionary *env = [NSMutableDictionary dictionary];
@@ -4989,6 +5011,7 @@
*/
- (void)dealloc
{
+
// Unregister observers
[prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines];
[prefs removeObserver:tableSourceInstance forKeyPath:SPDisplayTableViewVerticalGridlines];
@@ -5037,6 +5060,7 @@
if (taskProgressWindow) [taskProgressWindow release];
if (serverSupport) [serverSupport release];
if (processID) [processID release];
+ if (runningBASHprocesses) [runningBASHprocesses release];
[super dealloc];
}