From 128ebf92ec0348ee09f48fe0b0b3e119b4f45bc3 Mon Sep 17 00:00:00 2001 From: Andy Arvanitis Date: Sun, 6 Oct 2013 22:53:36 -0700 Subject: [PATCH] Switch to MRR (from GC) in CurrentLineHighlighter for Xcode5 --- .../XCFixin_CurrentLineHighlighter.m | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/XCFixin_CurrentLineHighlighter/XCFixin_CurrentLineHighlighter.m b/XCFixin_CurrentLineHighlighter/XCFixin_CurrentLineHighlighter.m index f7088d1..018f7ce 100644 --- a/XCFixin_CurrentLineHighlighter/XCFixin_CurrentLineHighlighter.m +++ b/XCFixin_CurrentLineHighlighter/XCFixin_CurrentLineHighlighter.m @@ -78,6 +78,8 @@ - (id) init { - (void) dealloc { //----------------------------------------------------------------------------------------------- [[NSNotificationCenter defaultCenter] removeObserver:self]; + [sourceEditorViewClass release]; + [highlightColorAttributes release]; [super dealloc]; } @@ -107,6 +109,7 @@ - (void) loadHighlightColor { [NSDictionary dictionaryWithObjectsAndKeys: color, NSBackgroundColorAttributeName, nil]; + [highlightColorAttributes retain]; } } @@ -122,7 +125,7 @@ - (void) saveHighlightColor:(NSColor*)color { - (void) highlightLineInView:(id)view containingRange:(NSRange)range { //----------------------------------------------------------------------------------------------- @try { - [[view layoutManager] addTemporaryAttributes: highlightColorAttributes + [[view layoutManager] addTemporaryAttributes: highlightColorAttributes forCharacterRange: [[view string] lineRangeForRange:range] ]; } @catch ( NSException* exception ) { @@ -168,10 +171,15 @@ - (IBAction)changeColor:(id)sender { //----------------------------------------------------------------------------------------------- NSColorPanel* colorPanel = [NSColorPanel sharedColorPanel]; + [highlightColorAttributes release]; + highlightColorAttributes = [NSDictionary dictionaryWithObjectsAndKeys: [colorPanel color], NSBackgroundColorAttributeName, nil]; + + [highlightColorAttributes retain]; + [self saveHighlightColor:[colorPanel color]]; // Update window size (grow then back to what it was) in order to cause frame @@ -225,6 +233,7 @@ - (void) addItemToApplicationMenu { - (void) applicationReady:(NSNotification*)notification { //----------------------------------------------------------------------------------------------- sourceEditorViewClass = NSClassFromString(@"DVTSourceTextView"); + [sourceEditorViewClass retain]; [self loadHighlightColor]; }