From a964ac27c1ecb76cdbf09b0b2f386466285533c2 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Mon, 26 Oct 2015 16:14:17 +1100 Subject: Avoid possibility of ScintillaCocoa receiving idles after deallocation by severing the connection from TimerTarget back to ScintillaCocoa and releasing the notification queue. --- cocoa/ScintillaCocoa.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 9cb48e5c8..31538aea4 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -333,6 +333,18 @@ const CGFloat paddingHighlightY = 2; //-------------------------------------------------------------------------------------------------- +/** + * Method called by owning ScintillaCocoa object when it is destroyed. + */ +- (void) ownerDestroyed +{ + mTarget = NULL; + [notificationQueue release]; + notificationQueue = nil; +} + +//-------------------------------------------------------------------------------------------------- + /** * Method called by a timer installed by ScintillaCocoa. This two step approach is needed because * a native Obj-C class is required as target for the timer. @@ -408,6 +420,7 @@ ScintillaCocoa::ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin) ScintillaCocoa::~ScintillaCocoa() { Finalise(); + [timerTarget ownerDestroyed]; [timerTarget release]; } -- cgit v1.2.3