- Fixed wm iconphoto #615750

This commit is contained in:
Jaroslav Škarvada 2010-07-25 09:55:02 +00:00
parent c560a8eb9b
commit ff676a49ad
2 changed files with 113 additions and 1 deletions

View File

@ -0,0 +1,106 @@
--- tk8.5.8/unix/tkUnixWm.c 2009/08/01 08:08:18 1.58.2.3
+++ tk8.5.8/unix/tkUnixWm.c.new 2009/11/24 15:18:17 1.58.2.4
@@ -1462,8 +1462,7 @@
if (wmPtr->clientMachine != NULL) {
ckfree((char *) wmPtr->clientMachine);
}
- wmPtr->clientMachine = (char *)
- ckalloc((unsigned) (length + 1));
+ wmPtr->clientMachine = ckalloc((unsigned) length + 1);
strcpy(wmPtr->clientMachine, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
XTextProperty textProp;
@@ -1561,7 +1560,7 @@
return TCL_ERROR;
}
cmapList = (Window *) ckalloc((unsigned)
- ((windowObjc+1)*sizeof(Window)));
+ (windowObjc+1) * sizeof(Window));
gotToplevel = 0;
for (i = 0; i < windowObjc; i++) {
Tk_Window mapWin;
@@ -2069,7 +2068,7 @@
}
wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr);
wmPtr->hints.flags |= WindowGroupHint;
- wmPtr->leaderName = ckalloc((unsigned) (length + 1));
+ wmPtr->leaderName = ckalloc((unsigned) length + 1);
strcpy(wmPtr->leaderName, argv3);
}
UpdateHints(winPtr);
@@ -2297,7 +2296,7 @@
ckfree((char *) wmPtr->iconName);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->iconName = ckalloc((unsigned) (length + 1));
+ wmPtr->iconName = ckalloc((unsigned) length + 1);
strcpy(wmPtr->iconName, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
UpdateTitle(winPtr);
@@ -2335,7 +2334,7 @@
Tk_PhotoHandle photo;
Tk_PhotoImageBlock block;
int i, size = 0, width, height, index = 0, x, y, isDefault = 0;
- unsigned int *iconPropertyData;
+ unsigned long *iconPropertyData;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -2375,15 +2374,17 @@
/*
* We have calculated the size of the data. Try to allocate the needed
- * memory space.
+ * memory space. This is an unsigned long array (despite this being twice
+ * as much as is really needed on LP64 platforms) because that's what X
+ * defines CARD32 arrays to use. [Bug 2902814]
*/
- iconPropertyData = (unsigned int *)
- Tcl_AttemptAlloc(sizeof(unsigned int) * size);
+ iconPropertyData = (unsigned long *)
+ attemptckalloc(sizeof(unsigned long) * size);
if (iconPropertyData == NULL) {
return TCL_ERROR;
}
- memset(iconPropertyData, 0, sizeof(unsigned int) * size);
+ memset(iconPropertyData, 0, sizeof(unsigned long) * size);
for (i = 3 + isDefault; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
@@ -2421,7 +2422,7 @@
for (x = 0; x < width; x++) {
register unsigned char *pixelPtr =
block.pixelPtr + x*block.pixelSize + y*block.pitch;
- register unsigned int R, G, B, A;
+ register unsigned long R, G, B, A;
R = pixelPtr[block.offset[0]];
G = pixelPtr[block.offset[1]];
@@ -3388,7 +3389,7 @@
ckfree((char *) wmPtr->title);
}
argv3 = Tcl_GetStringFromObj(objv[3], &length);
- wmPtr->title = ckalloc((unsigned) (length + 1));
+ wmPtr->title = ckalloc((unsigned) length + 1);
strcpy(wmPtr->title, argv3);
if (!(wmPtr->flags & WM_NEVER_MAPPED)) {
@@ -5982,7 +5983,7 @@
protPtr = protPtr->nextPtr, count++) {
/* Empty loop body; we're just counting the handlers. */
}
- arrayPtr = (Atom *) ckalloc((unsigned) (count * sizeof(Atom)));
+ arrayPtr = (Atom *) ckalloc((unsigned) count * sizeof(Atom));
deleteWindowAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr,
"WM_DELETE_WINDOW");
pingAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_PING");
@@ -6378,7 +6379,7 @@
* add the toplevel itself as the last element of the list.
*/
- newPtr = (Window *) ckalloc((unsigned) ((count+2)*sizeof(Window)));
+ newPtr = (Window *) ckalloc((unsigned) (count+2) * sizeof(Window));
for (i = 0; i < count; i++) {
newPtr[i] = oldPtr[i];
}

View File

@ -4,7 +4,7 @@
Summary: The graphical toolkit for the Tcl scripting language
Name: tk
Version: %{vers}
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 1
License: TCL
Group: Development/Languages
@ -27,6 +27,8 @@ Patch2: tk8.5-conf.patch
Patch3: tk-seg_input.patch
# RHBZ#545807, this patch is tracked in tk tracker
Patch4: tk-8.5.7-color.patch
# RHBZ#615750
Patch5: tk-8.5.8-wmiconphoto-fix.patch
%description
When paired with the Tcl scripting language, Tk provides a fast and powerful
@ -52,6 +54,7 @@ The package contains the development files and man pages for tk.
%patch2 -p1 -b .conf
%patch3 -p1 -b .seg
%patch4 -p1 -b .color
%patch5 -p1 -b .wmiconphoto-fix
%build
cd unix
@ -119,6 +122,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/*
%changelog
* Sun Jul 25 2010 Jaroslav Škarvada <jskarvad@redhat.com> - 1:8.5.8-2
- Fixed wm iconphoto #615750
* Thu Mar 18 2010 Jaroslav Škarvada <jskarvad@redhat.com> - 1:8.5.8-1
- Update to 8.5.8