From 1b83e14b1f5640881deeb03c1d11df5197746b64 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Mon, 25 Mar 2013 16:19:46 +0000 Subject: Fix issues found by the clang static analyzer --- tikzit/src/common/CircleShape.m | 38 +++++++++++------------ tikzit/src/common/ColorRGB.m | 20 +++++++----- tikzit/src/common/Edge.m | 45 +++++++++++++-------------- tikzit/src/common/GraphChange.m | 3 +- tikzit/src/common/GraphElementData.m | 6 ++-- tikzit/src/common/GraphElementProperty.m | 36 +++++++++++++--------- tikzit/src/common/Node.m | 15 ++++----- tikzit/src/common/Preambles.m | 16 +++++----- tikzit/src/common/PropertyHolder.m | 14 ++++++--- tikzit/src/common/RectangleShape.m | 41 +++++++++++++------------ tikzit/src/common/Shape.m | 6 ++-- tikzit/src/common/TikzGraphAssembler.m | 3 +- tikzit/src/common/TikzShape.m | 52 ++++++++++++++++---------------- tikzit/src/gtk/Application.m | 2 +- tikzit/src/gtk/CairoRenderContext.m | 2 -- tikzit/src/gtk/Configuration.m | 8 ++--- tikzit/src/gtk/EdgeStylesPalette.m | 1 - tikzit/src/gtk/Menu.m | 7 ++--- tikzit/src/gtk/NodeStylesPalette.m | 1 - tikzit/src/gtk/PreambleEditor.m | 1 - tikzit/src/gtk/PreviewRenderer.m | 21 +++++++------ tikzit/src/gtk/PreviewWindow.m | 1 - tikzit/src/gtk/SettingsDialog.m | 1 - tikzit/src/gtk/TikzDocument.h | 4 +-- tikzit/src/gtk/TikzDocument.m | 6 ++-- tikzit/src/gtk/Window.h | 6 ++-- tikzit/src/gtk/Window.m | 10 +++--- tikzit/src/gtk/main.m | 1 + 28 files changed, 192 insertions(+), 175 deletions(-) diff --git a/tikzit/src/common/CircleShape.m b/tikzit/src/common/CircleShape.m index 954cff2..f2d1d52 100644 --- a/tikzit/src/common/CircleShape.m +++ b/tikzit/src/common/CircleShape.m @@ -28,26 +28,26 @@ @implementation CircleShape - (id)init { - [super init]; - - Node *n0,*n1,*n2,*n3; - - n0 = [Node nodeWithPoint:NSMakePoint( 0.0f, 0.2f)]; - n1 = [Node nodeWithPoint:NSMakePoint( 0.2f, 0.0f)]; - n2 = [Node nodeWithPoint:NSMakePoint( 0.0f, -0.2f)]; - n3 = [Node nodeWithPoint:NSMakePoint(-0.2f, 0.0f)]; - - Edge *e0,*e1,*e2,*e3; - - e0 = [Edge edgeWithSource:n0 andTarget:n1]; [e0 setBend:-45]; - e1 = [Edge edgeWithSource:n1 andTarget:n2]; [e1 setBend:-45]; - e2 = [Edge edgeWithSource:n2 andTarget:n3]; [e2 setBend:-45]; - e3 = [Edge edgeWithSource:n3 andTarget:n0]; [e3 setBend:-45]; - - paths = [[NSSet alloc] initWithObjects:[NSArray arrayWithObjects:e0,e1,e2,e3,nil],nil]; + self = [super init]; + if (self) { + Node *n0,*n1,*n2,*n3; + + n0 = [Node nodeWithPoint:NSMakePoint( 0.0f, 0.2f)]; + n1 = [Node nodeWithPoint:NSMakePoint( 0.2f, 0.0f)]; + n2 = [Node nodeWithPoint:NSMakePoint( 0.0f, -0.2f)]; + n3 = [Node nodeWithPoint:NSMakePoint(-0.2f, 0.0f)]; + + Edge *e0,*e1,*e2,*e3; + + e0 = [Edge edgeWithSource:n0 andTarget:n1]; [e0 setBend:-45]; + e1 = [Edge edgeWithSource:n1 andTarget:n2]; [e1 setBend:-45]; + e2 = [Edge edgeWithSource:n2 andTarget:n3]; [e2 setBend:-45]; + e3 = [Edge edgeWithSource:n3 andTarget:n0]; [e3 setBend:-45]; + + paths = [[NSSet alloc] initWithObjects:[NSArray arrayWithObjects:e0,e1,e2,e3,nil],nil]; - styleTikz = @"circle"; - + styleTikz = @"circle"; + } return self; } diff --git a/tikzit/src/common/ColorRGB.m b/tikzit/src/common/ColorRGB.m index 74d1c55..c108cfe 100644 --- a/tikzit/src/common/ColorRGB.m +++ b/tikzit/src/common/ColorRGB.m @@ -205,18 +205,22 @@ static NSMapTable *colorHash = nil; } - (id)initWithRed:(unsigned short)r green:(unsigned short)g blue:(unsigned short)b { - [super init]; - red = r; - green = g; - blue = b; + self = [super init]; + if (self) { + red = r; + green = g; + blue = b; + } return self; } - (id)initWithFloatRed:(float)r green:(float)g blue:(float)b { - [super init]; - red = round(r*255.0f); - green = round(g*255.0f); - blue = round(b*255.0f); + self = [super init]; + if (self) { + red = round(r*255.0f); + green = round(g*255.0f); + blue = round(b*255.0f); + } return self; } diff --git a/tikzit/src/common/Edge.m b/tikzit/src/common/Edge.m index 9b607e6..dfc505c 100644 --- a/tikzit/src/common/Edge.m +++ b/tikzit/src/common/Edge.m @@ -28,32 +28,33 @@ @implementation Edge - (id)init { - [super init]; - data = [[GraphElementData alloc] init]; - bend = 0; - inAngle = 135; - outAngle = 45; - bendMode = EdgeBendModeBasic; - weight = 0.4f; - dirty = YES; - source = nil; - target = nil; - edgeNode = nil; - sourceAnchor = @""; - targetAnchor = @""; - + self = [super init]; + if (self) { + data = [[GraphElementData alloc] init]; + bend = 0; + inAngle = 135; + outAngle = 45; + bendMode = EdgeBendModeBasic; + weight = 0.4f; + dirty = YES; + source = nil; + target = nil; + edgeNode = nil; + sourceAnchor = @""; + targetAnchor = @""; + } return self; } - (id)initWithSource:(Node*)s andTarget:(Node*)t { - [self init]; - - [self setSource:s]; - [self setTarget:t]; - edgeNode = nil; - - dirty = YES; - + self = [self init]; + if (self) { + [self setSource:s]; + [self setTarget:t]; + edgeNode = nil; + + dirty = YES; + } return self; } diff --git a/tikzit/src/common/GraphChange.m b/tikzit/src/common/GraphChange.m index a997f15..cb95332 100644 --- a/tikzit/src/common/GraphChange.m +++ b/tikzit/src/common/GraphChange.m @@ -32,8 +32,7 @@ @implementation GraphChange - (id)init { - [super init]; - return self; + return [super init]; } @synthesize changeType; diff --git a/tikzit/src/common/GraphElementData.m b/tikzit/src/common/GraphElementData.m index a99a432..0750296 100644 --- a/tikzit/src/common/GraphElementData.m +++ b/tikzit/src/common/GraphElementData.m @@ -32,8 +32,10 @@ } - (id)init { - [super init]; - properties = [[NSMutableArray alloc] init]; + self = [super init]; + if (self) { + properties = [[NSMutableArray alloc] init]; + } return self; } diff --git a/tikzit/src/common/GraphElementProperty.m b/tikzit/src/common/GraphElementProperty.m index 1e8ad3a..5a19ace 100644 --- a/tikzit/src/common/GraphElementProperty.m +++ b/tikzit/src/common/GraphElementProperty.m @@ -38,29 +38,35 @@ } - (id)initWithAtomName:(NSString*)n { - [super init]; - [self setKey:n]; - [self setValue:nil]; - isAtom = YES; - isKeyMatch = NO; + self = [super init]; + if (self) { + [self setKey:n]; + [self setValue:nil]; + isAtom = YES; + isKeyMatch = NO; + } return self; } - (id)initWithPropertyValue:(NSString*)v forKey:(NSString*)k { - [super init]; - [self setKey:k]; - [self setValue:v]; - isAtom = NO; - isKeyMatch = NO; + self = [super init]; + if (self) { + [self setKey:k]; + [self setValue:v]; + isAtom = NO; + isKeyMatch = NO; + } return self; } - (id)initWithKeyMatching:(NSString*)k { - [super init]; - [self setKey:k]; - [self setValue:nil]; - isAtom = NO; - isKeyMatch = YES; + self = [super init]; + if (self) { + [self setKey:k]; + [self setValue:nil]; + isAtom = NO; + isKeyMatch = YES; + } return self; } diff --git a/tikzit/src/common/Node.m b/tikzit/src/common/Node.m index 7818a28..e564e5d 100644 --- a/tikzit/src/common/Node.m +++ b/tikzit/src/common/Node.m @@ -29,17 +29,18 @@ @implementation Node - (id)initWithPoint:(NSPoint)p { - [super init]; - data = [[GraphElementData alloc] init]; - style = nil; - label = @""; - point = p; + self = [super init]; + if (self) { + data = [[GraphElementData alloc] init]; + style = nil; + label = @""; + point = p; + } return self; } - (id)init { - [self initWithPoint:NSMakePoint(0.0f, 0.0f)]; - return self; + return [self initWithPoint:NSMakePoint(0.0f, 0.0f)]; } - (id)copyWithZone:(NSZone*)z { diff --git a/tikzit/src/common/Preambles.m b/tikzit/src/common/Preambles.m index 5343127..d6d18e9 100644 --- a/tikzit/src/common/Preambles.m +++ b/tikzit/src/common/Preambles.m @@ -59,13 +59,15 @@ static NSString *POSTAMBLE = } - (id)init { - [super init]; - selectedPreambleName = @"default"; - preambleDict = [[NSMutableDictionary alloc] initWithCapacity:1]; - [preambleDict setObject:[self defaultPreamble] forKey:@"custom"]; - styles = nil; - edges = nil; - styleManager = nil; + self = [super init]; + if (self) { + selectedPreambleName = @"default"; + preambleDict = [[NSMutableDictionary alloc] initWithCapacity:1]; + [preambleDict setObject:[self defaultPreamble] forKey:@"custom"]; + styles = nil; + edges = nil; + styleManager = nil; + } return self; } diff --git a/tikzit/src/common/PropertyHolder.m b/tikzit/src/common/PropertyHolder.m index 82b4889..2b3442f 100644 --- a/tikzit/src/common/PropertyHolder.m +++ b/tikzit/src/common/PropertyHolder.m @@ -27,14 +27,18 @@ - (id)init { - [super init]; - notificationName = @"UnknownPropertyChanged"; + self = [super init]; + if (self) { + notificationName = @"UnknownPropertyChanged"; + } return self; } - (id)initWithNotificationName:(NSString*)n { - [super init]; - notificationName = [n copy]; + self = [super init]; + if (self) { + notificationName = [n copy]; + } return self; } @@ -65,4 +69,4 @@ @end -// vi:ft=objc:ts=4:noet:sts=4:sw=4 +// vi:ft=objc:ts=4:et:sts=4:sw=4 diff --git a/tikzit/src/common/RectangleShape.m b/tikzit/src/common/RectangleShape.m index e332d40..db9c803 100644 --- a/tikzit/src/common/RectangleShape.m +++ b/tikzit/src/common/RectangleShape.m @@ -28,26 +28,27 @@ @implementation RectangleShape - (id)init { - [super init]; - Node *n0,*n1,*n2,*n3; - float sz = 0.2f; - - n0 = [Node nodeWithPoint:NSMakePoint(-sz, sz)]; - n1 = [Node nodeWithPoint:NSMakePoint( sz, sz)]; - n2 = [Node nodeWithPoint:NSMakePoint( sz,-sz)]; - n3 = [Node nodeWithPoint:NSMakePoint(-sz,-sz)]; - - Edge *e0,*e1,*e2,*e3; - - e0 = [Edge edgeWithSource:n0 andTarget:n1]; - e1 = [Edge edgeWithSource:n1 andTarget:n2]; - e2 = [Edge edgeWithSource:n2 andTarget:n3]; - e3 = [Edge edgeWithSource:n3 andTarget:n0]; - - paths = [[NSSet alloc] initWithObjects:[NSArray arrayWithObjects:e0,e1,e2,e3,nil],nil]; - - styleTikz = @"rectangle"; - + self = [super init]; + if (self) { + Node *n0,*n1,*n2,*n3; + float sz = 0.2f; + + n0 = [Node nodeWithPoint:NSMakePoint(-sz, sz)]; + n1 = [Node nodeWithPoint:NSMakePoint( sz, sz)]; + n2 = [Node nodeWithPoint:NSMakePoint( sz,-sz)]; + n3 = [Node nodeWithPoint:NSMakePoint(-sz,-sz)]; + + Edge *e0,*e1,*e2,*e3; + + e0 = [Edge edgeWithSource:n0 andTarget:n1]; + e1 = [Edge edgeWithSource:n1 andTarget:n2]; + e2 = [Edge edgeWithSource:n2 andTarget:n3]; + e3 = [Edge edgeWithSource:n3 andTarget:n0]; + + paths = [[NSSet alloc] initWithObjects:[NSArray arrayWithObjects:e0,e1,e2,e3,nil],nil]; + + styleTikz = @"rectangle"; + } return self; } diff --git a/tikzit/src/common/Shape.m b/tikzit/src/common/Shape.m index 0f1b35b..e86b122 100644 --- a/tikzit/src/common/Shape.m +++ b/tikzit/src/common/Shape.m @@ -51,8 +51,10 @@ } - (id)init { - [super init]; - paths = nil; + self = [super init]; + if (self) { + paths = nil; + } return self; } diff --git a/tikzit/src/common/TikzGraphAssembler.m b/tikzit/src/common/TikzGraphAssembler.m index 0c24b7c..c49298f 100644 --- a/tikzit/src/common/TikzGraphAssembler.m +++ b/tikzit/src/common/TikzGraphAssembler.m @@ -30,7 +30,7 @@ @implementation TikzGraphAssembler - (id)init { - self = nil; + [self release]; return nil; } @@ -126,7 +126,6 @@ yylex(&lval, &lloc, scanner); r = !(yyget_leng(scanner) < [testTikz length]); yylex_destroy(scanner); - [testTikz autorelease]; return r; } diff --git a/tikzit/src/common/TikzShape.m b/tikzit/src/common/TikzShape.m index 8cf823b..9735371 100644 --- a/tikzit/src/common/TikzShape.m +++ b/tikzit/src/common/TikzShape.m @@ -27,32 +27,32 @@ @implementation TikzShape - (id)initWithTikzFile:(NSString*)file { - [super init]; - - NSString *tikz = [NSString stringWithContentsOfFile:file - encoding:NSUTF8StringEncoding - error:NULL]; - if (tikz == nil) return nil; - - Graph *graph = [Graph graphFromTikz:tikz]; - if (graph == nil) return nil; - - NSRect graphBounds = ([graph hasBoundingBox]) ? [graph boundingBox] : [graph bounds]; - - float sz = 0.5f; - - // the "screen" coordinate space fits in the shape bounds - Transformer *t = [Transformer transformer]; - float width_ratio = (2*sz) / graphBounds.size.width; - float height_ratio = (2*sz) / graphBounds.size.height; - [t setScale:MIN(width_ratio, height_ratio)]; - NSRect bds = [t rectToScreen:graphBounds]; - NSPoint shift = NSMakePoint(-NSMidX(bds), - -NSMidY(bds)); - [t setOrigin:shift]; - [graph applyTransformer:t]; - paths = [[graph pathCover] retain]; - + self = [super init]; + if (self) { + NSString *tikz = [NSString stringWithContentsOfFile:file + encoding:NSUTF8StringEncoding + error:NULL]; + if (tikz == nil) return nil; + + Graph *graph = [Graph graphFromTikz:tikz]; + if (graph == nil) return nil; + + NSRect graphBounds = ([graph hasBoundingBox]) ? [graph boundingBox] : [graph bounds]; + + float sz = 0.5f; + + // the "screen" coordinate space fits in the shape bounds + Transformer *t = [Transformer transformer]; + float width_ratio = (2*sz) / graphBounds.size.width; + float height_ratio = (2*sz) / graphBounds.size.height; + [t setScale:MIN(width_ratio, height_ratio)]; + NSRect bds = [t rectToScreen:graphBounds]; + NSPoint shift = NSMakePoint(-NSMidX(bds), + -NSMidY(bds)); + [t setOrigin:shift]; + [graph applyTransformer:t]; + paths = [[graph pathCover] retain]; + } return self; } diff --git a/tikzit/src/gtk/Application.m b/tikzit/src/gtk/Application.m index 2720bb6..89fb7fd 100644 --- a/tikzit/src/gtk/Application.m +++ b/tikzit/src/gtk/Application.m @@ -77,7 +77,7 @@ Application* app = nil; if (app != nil) { [self release]; self = app; - return app; + return self; } self = [super init]; diff --git a/tikzit/src/gtk/CairoRenderContext.m b/tikzit/src/gtk/CairoRenderContext.m index bed06a6..77e10b5 100644 --- a/tikzit/src/gtk/CairoRenderContext.m +++ b/tikzit/src/gtk/CairoRenderContext.m @@ -26,7 +26,6 @@ - (id) init { [self release]; - self = nil; return nil; } @@ -91,7 +90,6 @@ - (id) init { [self release]; - self = nil; return nil; } diff --git a/tikzit/src/gtk/Configuration.m b/tikzit/src/gtk/Configuration.m index 7a0e65f..6ac08e8 100644 --- a/tikzit/src/gtk/Configuration.m +++ b/tikzit/src/gtk/Configuration.m @@ -268,7 +268,7 @@ gsize length; gchar **list = g_key_file_get_string_list (file, [group UTF8String], [key UTF8String], &length, NULL); if (list) { - NSMutableArray *result = [NSMutableArray new]; + NSMutableArray *result = [NSMutableArray arrayWithCapacity:length]; for (int i = 0; i < length; ++i) { [result addObject:[NSString stringWithUTF8String:list[i]]]; } @@ -288,7 +288,7 @@ gsize length; gboolean *list = g_key_file_get_boolean_list (file, [group UTF8String], [key UTF8String], &length, NULL); if (list) { - NSMutableArray *result = [NSMutableArray new]; + NSMutableArray *result = [NSMutableArray arrayWithCapacity:length]; for (int i = 0; i < length; ++i) { [result addObject:[NSNumber numberWithBool:list[i]]]; } @@ -308,7 +308,7 @@ gsize length; gint *list = g_key_file_get_integer_list (file, [group UTF8String], [key UTF8String], &length, NULL); if (list) { - NSMutableArray *result = [NSMutableArray new]; + NSMutableArray *result = [NSMutableArray arrayWithCapacity:length]; for (int i = 0; i < length; ++i) { [result addObject:[NSNumber numberWithInt:list[i]]]; } @@ -328,7 +328,7 @@ gsize length; double *list = g_key_file_get_double_list (file, [group UTF8String], [key UTF8String], &length, NULL); if (list) { - NSMutableArray *result = [NSMutableArray new]; + NSMutableArray *result = [NSMutableArray arrayWithCapacity:length]; for (int i = 0; i < length; ++i) { [result addObject:[NSNumber numberWithDouble:list[i]]]; } diff --git a/tikzit/src/gtk/EdgeStylesPalette.m b/tikzit/src/gtk/EdgeStylesPalette.m index 066b38c..33264cf 100644 --- a/tikzit/src/gtk/EdgeStylesPalette.m +++ b/tikzit/src/gtk/EdgeStylesPalette.m @@ -52,7 +52,6 @@ static void remove_style_button_cb (GtkButton *widget, EdgeStylesPalette *palett - (id) init { [self release]; - self = nil; return nil; } diff --git a/tikzit/src/gtk/Menu.m b/tikzit/src/gtk/Menu.m index 83bb2b3..677b48f 100644 --- a/tikzit/src/gtk/Menu.m +++ b/tikzit/src/gtk/Menu.m @@ -234,19 +234,19 @@ static void redo_cb (GtkAction *action, Window *window) { static void cut_cb (GtkAction *action, Window *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [window cut]; + [window selectionCutToClipboard]; [pool drain]; } static void copy_cb (GtkAction *action, Window *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [window copy]; + [window selectionCopyToClipboard]; [pool drain]; } static void paste_cb (GtkAction *action, Window *window) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - [window paste]; + [window pasteFromClipboard]; [pool drain]; } @@ -574,7 +574,6 @@ static void tool_cb (GtkAction *action, id tool) { - (id) init { [self release]; - self = nil; return nil; } diff --git a/tikzit/src/gtk/NodeStylesPalette.m b/tikzit/src/gtk/NodeStylesPalette.m index a3c69f7..e28edbb 100644 --- a/tikzit/src/gtk/NodeStylesPalette.m +++ b/tikzit/src/gtk/NodeStylesPalette.m @@ -52,7 +52,6 @@ static void remove_style_button_cb (GtkButton *widget, NodeStylesPalette *palett - (id) init { [self release]; - self = nil; return nil; } diff --git a/tikzit/src/gtk/PreambleEditor.m b/tikzit/src/gtk/PreambleEditor.m index b4eb9c7..d1f72ee 100644 --- a/tikzit/src/gtk/PreambleEditor.m +++ b/tikzit/src/gtk/PreambleEditor.m @@ -72,7 +72,6 @@ static void preamble_selection_changed_cb (GtkTreeSelection *treeselection, - (id) init { [self release]; - self = nil; return nil; } diff --git a/tikzit/src/gtk/PreviewRenderer.m b/tikzit/src/gtk/PreviewRenderer.m index 43fbe98..26293b5 100644 --- a/tikzit/src/gtk/PreviewRenderer.m +++ b/tikzit/src/gtk/PreviewRenderer.m @@ -28,7 +28,6 @@ - (id) init { [self release]; - self = nil; return nil; } @@ -140,27 +139,30 @@ } NS_HANDLER { NSLog(@"Failed to run '%@'; error was: %@", path, [localException reason]); (void)localException; - NSString *desc = [NSString stringWithFormat:@"Failed to run '%@'", path]; - NSMutableDictionary *errorDetail = [NSMutableDictionary dictionaryWithCapacity:2]; - [errorDetail setValue:desc forKey:NSLocalizedDescriptionKey]; - *error = [NSError errorWithDomain:TZErrorDomain code:TZ_ERR_IO userInfo:errorDetail]; + if (error) { + NSString *desc = [NSString stringWithFormat:@"Failed to run '%@'", path]; + NSMutableDictionary *errorDetail = [NSMutableDictionary dictionaryWithCapacity:2]; + [errorDetail setValue:desc forKey:NSLocalizedDescriptionKey]; + *error = [NSError errorWithDomain:TZErrorDomain code:TZ_ERR_IO userInfo:errorDetail]; + } // remove all temporary files [[NSFileManager defaultManager] removeFileAtPath:tempDir handler:NULL]; + [latexTask release]; return NO; } NS_ENDHANDLER - NSData *data = [latexOut readDataToEndOfFile]; - NSString *str = [[NSString alloc] initWithData:data - encoding:NSUTF8StringEncoding]; - if ([latexTask terminationStatus] != 0) { if (error) { + NSData *data = [latexOut readDataToEndOfFile]; + NSString *str = [[NSString alloc] initWithData:data + encoding:NSUTF8StringEncoding]; NSMutableDictionary *errorDetail = [NSMutableDictionary dictionaryWithCapacity:2]; [errorDetail setValue:@"Generating a PDF file with pdflatex failed" forKey:NSLocalizedDescriptionKey]; [errorDetail setValue:str forKey:TZToolOutputErrorKey]; *error = [NSError errorWithDomain:TZErrorDomain code:TZ_ERR_TOOL_FAILED userInfo:errorDetail]; + [str release]; } } else { // load pdf document @@ -189,6 +191,7 @@ // remove all temporary files [[NSFileManager defaultManager] removeFileAtPath:tempDir handler:NULL]; + [latexTask release]; return success; } diff --git a/tikzit/src/gtk/PreviewWindow.m b/tikzit/src/gtk/PreviewWindow.m index c5f138a..cb61ee3 100644 --- a/tikzit/src/gtk/PreviewWindow.m +++ b/tikzit/src/gtk/PreviewWindow.m @@ -35,7 +35,6 @@ - (id) init { [self release]; - self = nil; return nil; } diff --git a/tikzit/src/gtk/SettingsDialog.m b/tikzit/src/gtk/SettingsDialog.m index e3d8e6b..2844e81 100644 --- a/tikzit/src/gtk/SettingsDialog.m +++ b/tikzit/src/gtk/SettingsDialog.m @@ -45,7 +45,6 @@ static void cancel_button_clicked_cb (GtkButton *widget, SettingsDialog *dialog) - (id) init { [self release]; - self = nil; return nil; } diff --git a/tikzit/src/gtk/TikzDocument.h b/tikzit/src/gtk/TikzDocument.h index 2b55f05..5d15d13 100644 --- a/tikzit/src/gtk/TikzDocument.h +++ b/tikzit/src/gtk/TikzDocument.h @@ -72,8 +72,8 @@ - (BOOL) updateTikz:(NSString*)t error:(NSError**)error; -- (Graph*) cutSelection; -- (Graph*) copySelection; +- (Graph*) selectionCut; +- (Graph*) selectionCopy; - (void) paste:(Graph*)graph; - (void) pasteFromTikz:(NSString*)tikz; diff --git a/tikzit/src/gtk/TikzDocument.m b/tikzit/src/gtk/TikzDocument.m index 86b8afb..6e013b1 100644 --- a/tikzit/src/gtk/TikzDocument.m +++ b/tikzit/src/gtk/TikzDocument.m @@ -276,15 +276,15 @@ return NO; } -- (Graph*) cutSelection { - Graph *selection = [self copySelection]; +- (Graph*) selectionCut { + Graph *selection = [self selectionCopy]; [self startUndoGroup]; [self removeSelected]; [self nameAndEndUndoGroup:@"Cut"]; return selection; } -- (Graph*) copySelection { +- (Graph*) selectionCopy { return [[graph copyOfSubgraphWithNodes:[pickSupport selectedNodes]] autorelease]; } diff --git a/tikzit/src/gtk/Window.h b/tikzit/src/gtk/Window.h index 42e3588..62af643 100644 --- a/tikzit/src/gtk/Window.h +++ b/tikzit/src/gtk/Window.h @@ -114,15 +114,15 @@ /** * Cut the current selection to the clipboard. */ -- (void) cut; +- (void) selectionCutToClipboard; /** * Copy the current selection to the clipboard. */ -- (void) copy; +- (void) selectionCopyToClipboard; /** * Paste from the clipboard to the appropriate place. */ -- (void) paste; +- (void) pasteFromClipboard; /** * The GTK+ window that this class manages. diff --git a/tikzit/src/gtk/Window.m b/tikzit/src/gtk/Window.m index d6d7adb..dd9ee3c 100644 --- a/tikzit/src/gtk/Window.m +++ b/tikzit/src/gtk/Window.m @@ -354,19 +354,19 @@ static void update_paste_action (GtkClipboard *clipboard, GdkEvent *event, GtkAc } } -- (void) cut { +- (void) selectionCutToClipboard { if ([[[document pickSupport] selectedNodes] count] > 0) { - [self _placeGraphOnClipboard:[document cutSelection]]; + [self _placeGraphOnClipboard:[document selectionCut]]; } } -- (void) copy { +- (void) selectionCopyToClipboard { if ([[[document pickSupport] selectedNodes] count] > 0) { - [self _placeGraphOnClipboard:[document copySelection]]; + [self _placeGraphOnClipboard:[document selectionCopy]]; } } -- (void) paste { +- (void) pasteFromClipboard { gtk_clipboard_request_contents (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), tikzit_picture_atom, clipboard_paste_contents, diff --git a/tikzit/src/gtk/main.m b/tikzit/src/gtk/main.m index f9b72c8..f56a7b1 100644 --- a/tikzit/src/gtk/main.m +++ b/tikzit/src/gtk/main.m @@ -102,6 +102,7 @@ int main (int argc, char *argv[]) { gtk_main (); [app saveConfiguration]; + [app release]; return 0; } -- cgit v1.2.3