summaryrefslogtreecommitdiff
path: root/ext/tcltklib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tcltklib')
-rw-r--r--ext/tcltklib/tcltklib.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index 0217ab8feb6..84a999d7e45 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -2781,8 +2781,13 @@ ip_thread_tkwait(self, mode, target)
VALUE del_root(ip)
Tcl_Interp *ip;
{
+ Tk_Window main_win;
+
Tcl_Preserve(ip);
- Tk_DestroyWindow(Tk_MainWindow(ip));
+ main_win = Tk_MainWindow(ip);
+ if (main_win != (Tk_Window)NULL) {
+ Tk_DestroyWindow(main_win);
+ }
Tcl_Release(ip);
return Qnil;
}