summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2024-07-08 01:26:26 (GMT)
committerculler <culler>2024-07-08 01:26:26 (GMT)
commitd516c14a8643ea0b488683bd1b4b0e34c9a91f64 (patch)
tree8dc8daa70af15e931fb8f21147d502a13539277f /macosx
parent6b412ef050bae794cc765a9d13a415a9912a8142 (diff)
downloadtk-d516c14a8643ea0b488683bd1b4b0e34c9a91f64.zip
tk-d516c14a8643ea0b488683bd1b4b0e34c9a91f64.tar.gz
tk-d516c14a8643ea0b488683bd1b4b0e34c9a91f64.tar.bz2
Release the CGImageBitmapContext when the ContentView is destroyed.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXWindowEvent.c3
-rw-r--r--macosx/tkMacOSXWm.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 8065962..2915af1 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -1352,7 +1352,8 @@ static const char *const accentNames[] = {
(long)(self.tkLayerBitmapContext ?
CFGetRetainCount(self.tkLayerBitmapContext) : LONG_MIN));
#endif
- CGContextRelease(self.tkLayerBitmapContext); // will also need this in a destructor somewhere
+ // The context is also released in TkWmDeadWindow.
+ CGContextRelease(self.tkLayerBitmapContext);
self.tkLayerBitmapContext = newCtx;
}
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 875b11c..fbea56b 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1323,8 +1323,9 @@ TkWmDeadWindow(
* Avoid redrawing the view after it is released.
*/
- Tcl_CancelIdleCall(TkMacOSXRedrawViewIdleTask,
- (void *) [deadNSWindow contentView]);
+ TKContentView *deadView = [deadNSWindow contentView];
+ Tcl_CancelIdleCall(TkMacOSXRedrawViewIdleTask,(void *) deadView);
+ CGContextRelease(deadView.tkLayerBitmapContext);
[deadNSWindow close];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];