summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2005-02-11 20:36:26 (GMT)
committerhobbs <hobbs>2005-02-11 20:36:26 (GMT)
commit998d1248fae5cf14659a82c9ddd29afa73f773c1 (patch)
tree6570a152d09b9f0750b202b79b21cda2f5c3cc20
parentfa2eccae90e9ec0d0373bc4d443753b9a205262f (diff)
downloadtk-998d1248fae5cf14659a82c9ddd29afa73f773c1.zip
tk-998d1248fae5cf14659a82c9ddd29afa73f773c1.tar.gz
tk-998d1248fae5cf14659a82c9ddd29afa73f773c1.tar.bz2
* win/tkWinWm.c (TkWinGetIcon): fix toplevel retrieval for
determining icon ref (potential crash). [Bug 1105738]
-rw-r--r--ChangeLog3
-rw-r--r--win/tkWinWm.c21
2 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 31806ec..bb68914 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2005-02-11 Jeff Hobbs <jeffh@ActiveState.com>
+ * win/tkWinWm.c (TkWinGetIcon): fix toplevel retrieval for
+ determining icon ref (potential crash). [Bug 1105738]
+
* generic/tkCanvBmap.c (ConfigureBitmap, ComputeBitmapBbox): Fixed
possible crash with disabled bmap and bbox handling [Bug 1119460]
(BitmapToPostscript): made aware of various bitmap types
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 6551081..df0478b 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinWm.c,v 1.95 2005/01/31 04:08:32 chengyemao Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.96 2005/02/11 20:36:28 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -1130,9 +1130,8 @@ WinSetIcon(interp, titlebaricon, tkw)
*----------------------------------------------------------------------
*/
HICON
-TkWinGetIcon(Tk_Window tkw, DWORD iconsize)
+TkWinGetIcon(Tk_Window tkwin, DWORD iconsize)
{
- TkWindow *winPtr;
WmInfo *wmPtr;
HICON icon;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -1145,17 +1144,19 @@ TkWinGetIcon(Tk_Window tkw, DWORD iconsize)
return GetIcon(tsdPtr->iconPtr, iconsize);
}
- if (Tk_WindowId(tkw) == None) {
- Tk_MakeWindowExist(tkw);
+ /* ensure we operate on the toplevel, that has the icon refs */
+ while (!Tk_IsTopLevel(tkwin)) {
+ tkwin = Tk_Parent(tkwin);
+ if (tkwin == NULL) {
+ return NULL;
+ }
}
- winPtr = (TkWindow *)tkw;
- if (!(Tk_IsTopLevel(tkw))) {
- winPtr = GetTopLevel(Tk_GetHWND(Tk_WindowId(tkw)));
+ if (Tk_WindowId(tkwin) == None) {
+ Tk_MakeWindowExist(tkwin);
}
- /* We must get the window's wrapper, not the window itself */
- wmPtr = winPtr->wmInfoPtr;
+ wmPtr = ((TkWindow *) tkwin)->wmInfoPtr;
if (wmPtr->iconPtr != NULL) {
/*
* return window toplevel icon