diff options
Diffstat (limited to 'tk/win/tkWinEmbed.c')
-rw-r--r-- | tk/win/tkWinEmbed.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tk/win/tkWinEmbed.c b/tk/win/tkWinEmbed.c index 55893afa65a..249dae1cf36 100644 --- a/tk/win/tkWinEmbed.c +++ b/tk/win/tkWinEmbed.c @@ -110,7 +110,7 @@ TkpTestembedCmd(clientData, interp, argc, argv) ClientData clientData; Tcl_Interp *interp; int argc; - char **argv; + CONST char **argv; { return TCL_OK; } @@ -144,10 +144,11 @@ TkpUseWindow(interp, tkwin, string) * if string is bogus. */ Tk_Window tkwin; /* Tk window that does not yet have an * associated X window. */ - char *string; /* String identifying an X window to use + CONST char *string; /* String identifying an X window to use * for tkwin; must be an integer value. */ { TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *usePtr; int id; HWND hwnd; Container *containerPtr; @@ -177,6 +178,15 @@ TkpUseWindow(interp, tkwin, string) return TCL_ERROR; } + usePtr = (TkWindow *) Tk_HWNDToWindow(hwnd); + if (usePtr != NULL) { + if (!(usePtr->flags & TK_CONTAINER)) { + Tcl_AppendResult(interp, "window \"", usePtr->pathName, + "\" doesn't have -container option set", (char *) NULL); + return TCL_ERROR; + } + } + /* * Store the parent window in the platform private data slot so * TkWmMapWindow can use it when creating the wrapper window. @@ -397,7 +407,7 @@ TkWinEmbeddedEventProc(hwnd, message, wParam, lParam) break; case TK_GEOMETRYREQ: - EmbedGeometryRequest(containerPtr, wParam, lParam); + EmbedGeometryRequest(containerPtr, (int) wParam, lParam); break; } return 1; @@ -628,10 +638,12 @@ EmbedWindowDeleted(winPtr) * Find the Container structure for this window work. Delete the * information about the embedded application and free the container's * record. + * The main container may be null. [Bug #476176] */ prevPtr = NULL; containerPtr = tsdPtr->firstContainerPtr; + if (containerPtr == NULL) return; while (1) { if (containerPtr->embeddedPtr == winPtr) { containerPtr->embeddedHWnd = NULL; @@ -658,4 +670,3 @@ EmbedWindowDeleted(winPtr) ckfree((char *) containerPtr); } } - |