diff options
| author | nyamatongwe <unknown> | 2009-09-04 13:10:56 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2009-09-04 13:10:56 +0000 | 
| commit | d5e42b78a2b7564c7e3a18daf67a8dea99d28724 (patch) | |
| tree | 14f95125eabdb66adbac884b9e709b2f187da42d | |
| parent | d31af315a209ab200faa4f6c1d50ce0b4ddee7ca (diff) | |
| download | scintilla-mirror-d5e42b78a2b7564c7e3a18daf67a8dea99d28724.tar.gz | |
Fix in the InfoBar to avoid setting a cell class for the entire application.
Fixed memory leak re. notification center.
Cursor handling did not properly retain the used cursor image.
| -rw-r--r-- | cocoa/InfoBar.mm | 4 | ||||
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 2 | ||||
| -rw-r--r-- | cocoa/ScintillaView.h | 1 | ||||
| -rw-r--r-- | cocoa/ScintillaView.mm | 20 | 
4 files changed, 20 insertions, 7 deletions
| diff --git a/cocoa/InfoBar.mm b/cocoa/InfoBar.mm index 90b51c373..a96634dd1 100644 --- a/cocoa/InfoBar.mm +++ b/cocoa/InfoBar.mm @@ -188,6 +188,7 @@ static float BarFontSize = 10.0;    [mZoomPopup release];    // 2) The caret position label. +  Class oldCellClass = [NSTextField cellClass];    [NSTextField setCellClass: [VerticallyCenteredTextFieldCell class]];    mCaretPositionLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 50.0, 1.0)]; @@ -219,6 +220,9 @@ static float BarFontSize = 10.0;    [self addSubview: mStatusTextLabel];    [mStatusTextLabel release]; +   +  // Restore original cell class so that everything else doesn't get broken +  [NSTextField setCellClass: oldCellClass];  }  //-------------------------------------------------------------------------------------------------- diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 322e7c679..81dd991e7 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -137,7 +137,7 @@ static const KeyToCommand macMapDefault[] =      // Get the default notification queue for the thread which created the instance (usually the      // main thread). We need that later for idle event processing.      NSNotificationCenter* center = [NSNotificationCenter defaultCenter];  -    notificationQueue = [[NSNotificationQueue alloc] initWithNotificationCenter: center]; +    notificationQueue = [[[NSNotificationQueue alloc] initWithNotificationCenter: center] autorelease];      [center addObserver: self selector: @selector(idleTriggered:) name: @"Idle" object: nil];     }    return self; diff --git a/cocoa/ScintillaView.h b/cocoa/ScintillaView.h index 41861226f..574c2337d 100644 --- a/cocoa/ScintillaView.h +++ b/cocoa/ScintillaView.h @@ -37,6 +37,7 @@    int mLastPosition;  } +- (void) dealloc;  - (void) removeMarkedText;  - (void) setCursor: (Scintilla::Window::Cursor) cursor; diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index a7b7a502e..fdfe08db5 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -32,7 +32,7 @@ static NSCursor* waitCursor;    if (self != nil)    {      // Some initialization for our view. -    mCurrentCursor = [NSCursor arrowCursor]; +    mCurrentCursor = [[NSCursor arrowCursor] retain];      mCurrentTrackingRect = 0;      mMarkedTextRange = NSMakeRange(NSNotFound, 0); @@ -69,6 +69,7 @@ static NSCursor* waitCursor;   */  - (void) setCursor: (Window::Cursor) cursor  { +  [mCurrentCursor autorelease];    switch (cursor)    {      case Window::cursorText: @@ -95,6 +96,8 @@ static NSCursor* waitCursor;        break;    } +  [mCurrentCursor retain]; +      // Trigger recreation of the cursor rectangle(s).    [[self window] invalidateCursorRectsForView: self];  } @@ -529,6 +532,14 @@ static NSCursor* waitCursor;    mOwner.backend->Redo();  } +//-------------------------------------------------------------------------------------------------- + +- (void) dealloc +{ +  [mCurrentCursor release]; +  [super dealloc]; +} +  @end  //-------------------------------------------------------------------------------------------------- @@ -556,11 +567,11 @@ static NSCursor* waitCursor;      NSString* path = [bundle pathForResource: @"mac_cursor_busy" ofType: @"png" inDirectory: nil];      NSImage* image = [[[NSImage alloc] initWithContentsOfFile: path] autorelease]; -    waitCursor = [[[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(2, 2)] retain]; +    waitCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(2, 2)];      path = [bundle pathForResource: @"mac_cursor_flipped" ofType: @"png" inDirectory: nil];      image = [[[NSImage alloc] initWithContentsOfFile: path] autorelease]; -    reverseArrowCursor = [[[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(12, 2)] retain]; +    reverseArrowCursor = [[NSCursor alloc] initWithImage: image hotSpot: NSMakePoint(12, 2)];    }  } @@ -722,9 +733,6 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa  //-------------------------------------------------------------------------------------------------- -/** - * Release the backend. - */  - (void) dealloc  {    [mInfoBar release]; | 
