summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXKeyEvent.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-05-31 20:37:49 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-05-31 20:37:49 (GMT)
commitc863ce89c89677c300b8e558c0d4e53a0856d1f8 (patch)
tree38e3ab38dfea8aa3720f55d483bb35523d4fa9ad /macosx/tkMacOSXKeyEvent.c
parent9d349c258df6d68a65afdd4be3de4a93d14108ee (diff)
parent36ecdb06871a56957e1ccb3b2b42fcf80a6884b0 (diff)
downloadtk-c863ce89c89677c300b8e558c0d4e53a0856d1f8.zip
tk-c863ce89c89677c300b8e558c0d4e53a0856d1f8.tar.gz
tk-c863ce89c89677c300b8e558c0d4e53a0856d1f8.tar.bz2
Fix [4666f21a95]: Avoid a non-evident crash (and resolve conflict in tkMacOSXEmbed.c function Tk_GetOtherWindow() following changes in TIP #606).
Diffstat (limited to 'macosx/tkMacOSXKeyEvent.c')
-rw-r--r--macosx/tkMacOSXKeyEvent.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c
index 3c71a16..d282427 100644
--- a/macosx/tkMacOSXKeyEvent.c
+++ b/macosx/tkMacOSXKeyEvent.c
@@ -670,9 +670,12 @@ setXEventPoint(
local.x -= contPtr->wmInfoPtr->xInParent;
local.y -= contPtr->wmInfoPtr->yInParent;
} else {
- TkWindow *topPtr = TkMacOSXGetHostToplevel(winPtr)->winPtr;
- local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x);
- local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y);
+ MacDrawable *topMacWin = TkMacOSXGetHostToplevel(winPtr);
+ if (topMacWin) {
+ TkWindow *topPtr = topMacWin->winPtr;
+ local.x -= (topPtr->wmInfoPtr->xInParent + contPtr->changes.x);
+ local.y -= (topPtr->wmInfoPtr->yInParent + contPtr->changes.y);
+ }
}
} else if (winPtr->wmInfoPtr != NULL) {
local.x -= winPtr->wmInfoPtr->xInParent;