summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWm.c
diff options
context:
space:
mode:
authorculler <culler>2021-04-27 19:35:45 (GMT)
committerculler <culler>2021-04-27 19:35:45 (GMT)
commit5548b9384faa00a2bb51f6b6f1cb9533eeaf246c (patch)
tree7790e3ac58ccc33220258152a4f30667daf5259b /macosx/tkMacOSXWm.c
parent81a7dbc90f3961dc72cc728dc321d7e488e4d4c1 (diff)
downloadtk-5548b9384faa00a2bb51f6b6f1cb9533eeaf246c.zip
tk-5548b9384faa00a2bb51f6b6f1cb9533eeaf246c.tar.gz
tk-5548b9384faa00a2bb51f6b6f1cb9533eeaf246c.tar.bz2
Try to avoid the rare crash in Tk_MacOSXGetTkWindow which has been seen at exit a few times.
Diffstat (limited to 'macosx/tkMacOSXWm.c')
-rw-r--r--macosx/tkMacOSXWm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 4f073d8..77f7b09 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -5535,12 +5535,15 @@ Tk_MacOSXGetTkWindow(
void *w)
{
Window window = None;
- TkDisplay *dispPtr = TkGetDisplayList();
if ([(NSWindow *)w respondsToSelector: @selector (tkWindow)]) {
window = [(TKWindow *)w tkWindow];
}
- return (window != None ?
- Tk_IdToWindow(dispPtr->display, window) : NULL);
+ if (window) {
+ TkDisplay *dispPtr = TkGetDisplayList();
+ return Tk_IdToWindow(dispPtr->display, window);
+ } else {
+ return NULL;
+ }
}
/*