summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXInit.c
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2022-09-14 16:27:28 (GMT)
committermarc_culler <marc.culler@gmail.com>2022-09-14 16:27:28 (GMT)
commit86b17d6aaedd2ae09b5758f12a9c9c999e51ce77 (patch)
tree64d8e5665479d73efccad3701461536ec51be7b6 /macosx/tkMacOSXInit.c
parent43fdce7518d6c83f40b1c5d07c89bb4bc28f1383 (diff)
downloadtk-86b17d6aaedd2ae09b5758f12a9c9c999e51ce77.zip
tk-86b17d6aaedd2ae09b5758f12a9c9c999e51ce77.tar.gz
tk-86b17d6aaedd2ae09b5758f12a9c9c999e51ce77.tar.bz2
Apply patch from Christopher Chavez to avoid use-after-free crashes.
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r--macosx/tkMacOSXInit.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index bf5b6de..a9b459a 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -45,8 +45,41 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
@synthesize needsToDraw = _needsToDraw;
@synthesize tkLiveResizeEnded = _tkLiveResizeEnded;
@synthesize tkPointerWindow = _tkPointerWindow;
+- (void) setTkPointerWindow: (TkWindow *)winPtr
+{
+ if (_tkPointerWindow) {
+ Tcl_Release(_tkPointerWindow);
+ }
+ if (winPtr) {
+ Tcl_Preserve(winPtr);
+ }
+ _tkPointerWindow = winPtr;
+ return;
+}
@synthesize tkEventTarget = _tkEventTarget;
+- (void) setTkEventTarget: (TkWindow *)winPtr
+{
+ if (_tkEventTarget) {
+ Tcl_Release(_tkEventTarget);
+ }
+ if (winPtr) {
+ Tcl_Preserve(winPtr);
+ }
+ _tkEventTarget = winPtr;
+ return;
+}
@synthesize tkDragTarget = _tkDragTarget;
+- (void) setTkDragTarget: (TkWindow *)winPtr
+{
+ if (_tkDragTarget) {
+ Tcl_Release(_tkDragTarget);
+ }
+ if (winPtr) {
+ Tcl_Preserve(winPtr);
+ }
+ _tkDragTarget = winPtr;
+ return;
+}
@synthesize tkButtonState = _tkButtonState;
@end