Author: manolo
Date: 2012-06-03 04:02:05 -0700 (Sun, 03 Jun 2012)
New Revision: 9572
Log:
More careful use of autorelease pools in secondary pthreads

Modified:
   branches/branch-3.0/src/fltk3/cocoa.mm

Modified: branches/branch-3.0/src/fltk3/cocoa.mm
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa.mm      2012-06-02 20:00:55 UTC (rev 
9571)
+++ branches/branch-3.0/src/fltk3/cocoa.mm      2012-06-03 11:02:05 UTC (rev 
9572)
@@ -323,8 +323,6 @@
 void* DataReady::DataReadyThread(void *o)
 {
   DataReady *self = (DataReady*)o;
-  NSAutoreleasePool *localPool;
-  localPool = [[NSAutoreleasePool alloc] init]; 
   while ( 1 ) {                                        // loop until thread 
cancel or error
     // Thread safe local copies of data before each select()
     self->DataLock();
@@ -354,6 +352,7 @@
         if (FD_ISSET(cancelpipe, &r) || FD_ISSET(cancelpipe, &x))      // 
cancel?
          { return(NULL); }                                             // just 
exit
         DEBUGMSG("CHILD THREAD: DATA IS READY\n");
+       NSAutoreleasePool *localPool = [[NSAutoreleasePool alloc] init]; 
         NSPoint pt={0,0};
         NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined 
location:pt 
                                       modifierFlags:0
@@ -361,6 +360,7 @@
                                         windowNumber:0 context:NULL 
                                             subtype:FLTKDataReadyEvent data1:0 
data2:0];
         [NSApp postEvent:event atStart:NO];
+       [localPool release];
         return(NULL);          // done with thread
       }
     }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to