aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/ScintillaView.mm
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2015-10-24 15:20:55 +1100
committerNeil Hodgson <nyamatongwe@gmail.com>2015-10-24 15:20:55 +1100
commitece8393319c2d51477768224853715cc5ea4b62c (patch)
treeb384b1b11e91dda101f6246b85eb3c89f1339f97 /cocoa/ScintillaView.mm
parent99c9ad7ef1f1d77b713577df72eae32d3f479cf6 (diff)
downloadscintilla-mirror-ece8393319c2d51477768224853715cc5ea4b62c.tar.gz
When deallocating ScintillaView, null out the reference to it from SCIContentView
since responsive scrolling causes callbacks after the deallocation. Also remove the scrollview to try to finalize it although it still lives for a short period.
Diffstat (limited to 'cocoa/ScintillaView.mm')
-rw-r--r--cocoa/ScintillaView.mm11
1 files changed, 10 insertions, 1 deletions
diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm
index 180a7542e..3a73355c4 100644
--- a/cocoa/ScintillaView.mm
+++ b/cocoa/ScintillaView.mm
@@ -241,6 +241,9 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
*/
- (void) viewWillDraw
{
+ if (!mOwner)
+ return;
+
const NSRect *rects;
NSInteger nRects = 0;
[self getRectsBeingDrawn:&rects count:&nRects];
@@ -261,7 +264,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
*/
- (void) prepareContentInRect: (NSRect) rect
{
- mOwner.backend->WillDraw(rect);
+ if (mOwner)
+ mOwner.backend->WillDraw(rect);
#if MAC_OS_X_VERSION_MAX_ALLOWED > 1080
[super prepareContentInRect: rect];
#endif
@@ -695,6 +699,8 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor)
*/
- (NSRect)adjustScroll:(NSRect)proposedVisibleRect
{
+ if (!mOwner)
+ return proposedVisibleRect;
NSRect rc = proposedVisibleRect;
// Snap to lines
NSRect contentRect = [self bounds];
@@ -1216,6 +1222,9 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
delete mBackend;
+ mBackend = NULL;
+ mContent.owner = nil;
+ [scrollView removeFromSuperview];
[marginView release];
[super dealloc];
}