Author: rmottola Date: Wed Oct 22 14:52:38 2014 New Revision: 38127 URL: http://svn.gna.org/viewcvs/gnustep?rev=38127&view=rev Log: Fix memory leak on pause, allow stopping of operation also when paused.
Modified: apps/gworkspace/trunk/ChangeLog apps/gworkspace/trunk/Operation/FileOpInfo.h apps/gworkspace/trunk/Operation/FileOpInfo.m Modified: apps/gworkspace/trunk/ChangeLog URL: http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/ChangeLog?rev=38127&r1=38126&r2=38127&view=diff ============================================================================== --- apps/gworkspace/trunk/ChangeLog (original) +++ apps/gworkspace/trunk/ChangeLog Wed Oct 22 14:52:38 2014 @@ -1,3 +1,9 @@ +2014-09-22 Riccardo Mottola <r...@gnu.org> + + * Operation/FileOpInfo.h + * Operation/FileOpInfo.m + Fix memory leak on pause, allow stopping of operation also when paused. + 2014-10-21 Riccardo Mottola <r...@gnu.org> * Operation/FileOpInfo.h Modified: apps/gworkspace/trunk/Operation/FileOpInfo.h URL: http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/Operation/FileOpInfo.h?rev=38127&r1=38126&r2=38127&view=diff ============================================================================== --- apps/gworkspace/trunk/Operation/FileOpInfo.h (original) +++ apps/gworkspace/trunk/Operation/FileOpInfo.h Wed Oct 22 14:52:38 2014 @@ -45,6 +45,8 @@ - (void)removeProcessedFiles; +- (void)cleanUpExecutor; + - (void)endOperation; @end @@ -152,6 +154,10 @@ - (void)setNumFiles:(int)n; - (void)setProgIndicatorValue:(int)n; + +- (void)removeProcessedFiles; + +- (void)cleanUpExecutor; - (void)endOperation; @@ -211,7 +217,9 @@ - (BOOL)checkSameName; -- (void)performOperation; +- (oneway void)calculateNumFiles:(NSUInteger)continueFrom; + +- (oneway void)performOperation; - (NSData *)processedFiles; Modified: apps/gworkspace/trunk/Operation/FileOpInfo.m URL: http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/Operation/FileOpInfo.m?rev=38127&r1=38126&r2=38127&view=diff ============================================================================== --- apps/gworkspace/trunk/Operation/FileOpInfo.m (original) +++ apps/gworkspace/trunk/Operation/FileOpInfo.m Wed Oct 22 14:52:38 2014 @@ -3,6 +3,7 @@ * Copyright (C) 2004-2014 Free Software Foundation, Inc. * * Author: Enrico Sersale <enr...@imago.ro> + * Riccardo Mottola <r...@gnu.org> * Date: March 2004 * * This file is part of the GNUstep GWorkspace application @@ -363,16 +364,14 @@ if (paused == NO) { NSLog(@"start pause remaining files: %d", [files count]); - [pauseButt setTitle: NSLocalizedString(@"Continue", @"")]; - [stopButt setEnabled: NO]; + [pauseButt setTitle: NSLocalizedString(@"Continue", @"")]; paused = YES; } else { NSLog(@"continue from pause"); [self detachOperationThread]; - [pauseButt setTitle: NSLocalizedString(@"Pause", @"")]; - [stopButt setEnabled: YES]; + [pauseButt setTitle: NSLocalizedString(@"Pause", @"")]; paused = NO; NSLog(@"performing operation...."); } @@ -380,6 +379,10 @@ - (IBAction)stop:(id)sender { + if (paused) + { + [self endOperation]; + } stopped = YES; } @@ -501,23 +504,28 @@ [progInd setDoubleValue: n]; } +- (void)cleanUpExecutor +{ + if (executor) + { + [nc removeObserver: self + name: NSConnectionDidDieNotification + object: execconn]; + DESTROY (executor); + DESTROY (execconn); + } +} + - (void)endOperation { - if (showwin) { - if ([progInd isIndeterminate]) { - [progInd stopAnimation:self]; - } - [win saveFrameUsingName: @"fopinfo"]; - [win close]; - } - - if (executor) { - [nc removeObserver: self - name: NSConnectionDidDieNotification - object: execconn]; - DESTROY (executor); - DESTROY (execconn); - } + if (showwin) + { + if ([progInd isIndeterminate]) + [progInd stopAnimation:self]; + + [win saveFrameUsingName: @"fopinfo"]; + [win close]; + } [controller endOfFileOperation: self]; } @@ -1053,14 +1061,16 @@ RELEASE (fileinfo); } + [fileOp sendDidChangeNotification]; if (([files count] == 0) || stopped) { - [self done]; + [fileOp endOperation]; } else if (paused) { [fileOp removeProcessedFiles]; } + [fileOp cleanUpExecutor]; } - (void)doCopy @@ -1083,14 +1093,16 @@ RELEASE (fileinfo); } + [fileOp sendDidChangeNotification]; if (([files count] == 0) || stopped) { - [self done]; + [fileOp endOperation]; } else if (paused) { [fileOp removeProcessedFiles]; } + [fileOp cleanUpExecutor]; } - (void)doLink @@ -1114,14 +1126,16 @@ RELEASE (fileinfo); } + [fileOp sendDidChangeNotification]; if (([files count] == 0) || stopped) { - [self done]; + [fileOp endOperation]; } else if (paused) { [fileOp removeProcessedFiles]; - } + } + [fileOp cleanUpExecutor]; } - (void)doRemove @@ -1140,14 +1154,16 @@ RELEASE (fileinfo); } + [fileOp sendDidChangeNotification]; if (([files count] == 0) || stopped) { - [self done]; + [fileOp endOperation]; } else if (paused) { [fileOp removeProcessedFiles]; - } + } + [fileOp cleanUpExecutor]; } - (void)doDuplicate @@ -1201,14 +1217,16 @@ RELEASE (fileinfo); } + [fileOp sendDidChangeNotification]; if (([files count] == 0) || stopped) { - [self done]; + [fileOp endOperation]; } else if (paused) { [fileOp removeProcessedFiles]; - } + } + [fileOp cleanUpExecutor]; } - (void)doRename @@ -1237,7 +1255,9 @@ [files removeObject: fileinfo]; RELEASE (fileinfo); - [self done]; + [fileOp sendDidChangeNotification]; + [fileOp endOperation]; + [fileOp cleanUpExecutor]; } - (void)doNewFolder @@ -1251,7 +1271,9 @@ [files removeObject: fileinfo]; RELEASE (fileinfo); - [self done]; + [fileOp sendDidChangeNotification]; + [fileOp endOperation]; + [fileOp cleanUpExecutor]; } - (void)doNewFile @@ -1266,7 +1288,9 @@ [files removeObject: fileinfo]; RELEASE (fileinfo); - [self done]; + [fileOp sendDidChangeNotification]; + [fileOp endOperation]; + [fileOp cleanUpExecutor]; } - (void)doTrash @@ -1335,14 +1359,16 @@ RELEASE (fileinfo); } + [fileOp sendDidChangeNotification]; if (([files count] == 0) || stopped) { - [self done]; + [fileOp endOperation]; } else if (paused) { [fileOp removeProcessedFiles]; - } + } + [fileOp cleanUpExecutor]; } - (BOOL)removeExisting:(NSDictionary *)info _______________________________________________ Gnustep-cvs mailing list Gnustep-cvs@gna.org https://mail.gna.org/listinfo/gnustep-cvs