Author: espectador
Date: Mon Apr  7 01:40:32 2014
New Revision: 37787

URL: http://svn.gna.org/viewcvs/gnustep?rev=37787&view=rev
Log:
Fix problem with launcher panel.

Modified:
    apps/projectcenter/trunk/ChangeLog
    apps/projectcenter/trunk/Framework/PCProjectLauncher.m
    apps/projectcenter/trunk/Headers/ProjectCenter/PCProjectLauncher.h

Modified: apps/projectcenter/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/ChangeLog?rev=37787&r1=37786&r2=37787&view=diff
==============================================================================
--- apps/projectcenter/trunk/ChangeLog  (original)
+++ apps/projectcenter/trunk/ChangeLog  Mon Apr  7 01:40:32 2014
@@ -1,3 +1,10 @@
+2014-04-06 German Arias <[email protected]>
+
+       * Headers/ProjectCenter/PCProjectLauncher.h: Add new variable
+       _isErrorRunning.
+       * Framework/PCProjectLauncher.m: Remove observer in -logStdOut: and
+       -logErrOut:. And wait until receive all data in -runDidTerminate:.
+
 2014-04-02 German Arias <[email protected]>
 
        * Framework/PCFileCreator.m (-replaceTagsInFileAtPath:withProject:):

Modified: apps/projectcenter/trunk/Framework/PCProjectLauncher.m
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Framework/PCProjectLauncher.m?rev=37787&r1=37786&r2=37787&view=diff
==============================================================================
--- apps/projectcenter/trunk/Framework/PCProjectLauncher.m      (original)
+++ apps/projectcenter/trunk/Framework/PCProjectLauncher.m      Mon Apr  7 
01:40:32 2014
@@ -399,6 +399,7 @@
   [debugButton setEnabled:NO];
 
   _isRunning = YES;
+  _isErrorRunning = YES;
   RELEASE(args);
 }
 
@@ -409,7 +410,16 @@
       return;
     }
 
-  [NOTIFICATION_CENTER removeObserver:self];
+  [NOTIFICATION_CENTER removeObserver: self
+                                name: NSTaskDidTerminateNotification
+                              object: launchTask];
+
+  // Wait if there are data available.
+  if (_isRunning || _isErrorRunning)
+    {
+      [[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
+                              beforeDate: [NSDate distantFuture]];
+    }
 
   [runButton setState:NSOffState];
   [debugButton setState:NSOffState];
@@ -419,7 +429,6 @@
 
   RELEASE(launchTask);
   launchTask = nil;
-  _isRunning = NO;
   _isDebugging = NO;
 
 }
@@ -428,24 +437,38 @@
 {
   NSData *data;
 
-  if ((data = [readHandle availableData]))
+  if ((data = [readHandle availableData]) && [data length] > 0)
     {
       [self logData:data error:NO];
-    }
-
-  [readHandle waitForDataInBackgroundAndNotifyForModes:nil];
+      [readHandle waitForDataInBackgroundAndNotifyForModes:nil];
+    }
+  else
+    {
+      [NOTIFICATION_CENTER removeObserver: self 
+                                    name: NSFileHandleDataAvailableNotification
+                                  object: readHandle];
+
+      _isRunning = NO;
+    }
 }
 
 - (void)logErrOut:(NSNotification *)aNotif
 {
   NSData *data;
    
-  if ((data = [errorReadHandle availableData]))
+  if ((data = [errorReadHandle availableData]) && [data length] > 0)
     {
       [self logData:data error:YES];
-    }
-                       
-  [errorReadHandle waitForDataInBackgroundAndNotifyForModes:nil];
+      [errorReadHandle waitForDataInBackgroundAndNotifyForModes:nil];
+    }
+  else
+    {
+      [NOTIFICATION_CENTER removeObserver: self 
+                                    name: NSFileHandleDataAvailableNotification
+                                  object: errorReadHandle];
+
+      _isErrorRunning = NO;
+    }
 }
 
 @end

Modified: apps/projectcenter/trunk/Headers/ProjectCenter/PCProjectLauncher.h
URL: 
http://svn.gna.org/viewcvs/gnustep/apps/projectcenter/trunk/Headers/ProjectCenter/PCProjectLauncher.h?rev=37787&r1=37786&r2=37787&view=diff
==============================================================================
--- apps/projectcenter/trunk/Headers/ProjectCenter/PCProjectLauncher.h  
(original)
+++ apps/projectcenter/trunk/Headers/ProjectCenter/PCProjectLauncher.h  Mon Apr 
 7 01:40:32 2014
@@ -50,6 +50,7 @@
 
   id<CodeDebugger> debugger;
   BOOL          _isRunning;
+  BOOL          _isErrorRunning;
   BOOL          _isDebugging;
 }
 


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to