[ Ressurecting this thread since I _think_ I may have found 
  something related while reading your other thread from today ]

On Wed 26.Nov'08 at 15:56:33 +0100, Martin Dietze wrote:
>  I recently installed crossover-office and using it installed
> and ran Apple's Safari browser for Windows. The application
> immediately crashed my WindowMaker session and it persits doing
> so. Playing a bit with the debugger and undocumented command
> line options (one should be able to disable the crash dialogue
> for easier debugging in such cases), I finally figured out that 
> WM segfaults in wmspec.c:1276, consider this code:
> 
>   if (XGetWindowProperty(dpy, wwin->client_win, net_wm_window_type, 0, 1,
>                  False, XA_ATOM, &type_ret, &fmt_ret, &nitems_ret,
>                  &bytes_after_ret, (unsigned char **)&data)==Success && data) 
> {

I found this

http://www.mail-archive.com/[email protected]/msg15492.html

which claims to have fixed a misbehavior in 64-bit

"PS: "Better" means: The decorations around the popups and the main
window are correct."

The patch is making the 4th and 5th arguments of XGetWindowProperty()
to be 'long' (as the prototype requires). So I remembered about this
thread where you quoted the code above with XGetWindowProperty()...

Hmm...perhaps this patch helps anything? I think I considered all
the cases I grep'ed, but it will need more review and (hopefully)
your testing.

Is your machine 64-bit, btw? :-)

PS: I am not sure about the change in src/properties.c and the
compiler warns about it. I just wanted to send this for testing...

From: Carlos R. Mafra <[email protected]>
Date: Mon, 24 Aug 2009 21:07:50 +0200
Subject: [PATCH] XGetWindowProperty() 64-bit cleanup

The 4th and 5th arguments of XGetWindowProperty() must be 'long'

---
 WINGs/dragdestination.c |    6 +++---
 WINGs/dragsource.c      |    4 ++--
 WINGs/selection.c       |    2 +-
 src/properties.c        |    6 +++---
 src/window.c            |    2 +-
 src/wmspec.c            |   18 +++++++++---------
 src/xdnd.c              |    4 ++--
 util/wxpaste.c          |    2 +-
 8 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/WINGs/dragdestination.c b/WINGs/dragdestination.c
index 0f1849f..1b67bdb 100644
--- a/WINGs/dragdestination.c
+++ b/WINGs/dragdestination.c
@@ -71,7 +71,7 @@ static WMArray *getTypesFromTypeList(WMScreen * scr, Window 
sourceWin)
        unsigned char *data = NULL;
 
        XGetWindowProperty(scr->display, sourceWin, scr->xdndTypeListAtom,
-                          0, 0x8000000L, False, XA_ATOM, &dataType, &format, 
&count, &remaining, &data);
+                          0L, 0x8000000L, False, XA_ATOM, &dataType, &format, 
&count, &remaining, &data);
 
        if (dataType != XA_ATOM || format != XDND_PROPERTY_FORMAT || count == 0 
|| !data) {
                if (data) {
@@ -168,7 +168,7 @@ WMArray *sourceOperationList(WMScreen * scr, Window 
sourceWin)
 
        remaining = 0;
        XGetWindowProperty(scr->display, sourceWin, scr->xdndActionListAtom,
-                          0, 0x8000000L, False, XA_ATOM, &dataType, &size, 
&count, &remaining, &actionDatas);
+                          0L, 0x8000000L, False, XA_ATOM, &dataType, &size, 
&count, &remaining, &actionDatas);
 
        if (dataType != XA_ATOM || size != XDND_PROPERTY_FORMAT || count == 0 
|| !actionDatas) {
                wwarning("Cannot read action list");
@@ -181,7 +181,7 @@ WMArray *sourceOperationList(WMScreen * scr, Window 
sourceWin)
        actionList = (Atom *) actionDatas;
 
        XGetWindowProperty(scr->display, sourceWin, 
scr->xdndActionDescriptionAtom,
-                          0, 0x8000000L, False, XA_STRING, &dataType, &size,
+                          0L, 0x8000000L, False, XA_STRING, &dataType, &size,
                           &count, &remaining, &descriptionList);
 
        if (dataType != XA_STRING || size != XDND_ACTION_DESCRIPTION_FORMAT || 
count == 0 || !descriptionList) {
diff --git a/WINGs/dragsource.c b/WINGs/dragsource.c
index eea0ef5..fa70959 100644
--- a/WINGs/dragsource.c
+++ b/WINGs/dragsource.c
@@ -622,7 +622,7 @@ static Bool isXdndAware(WMScreen * scr, Window win)
                return False;
 
        XGetWindowProperty(scr->display, win, scr->xdndAwareAtom,
-                          0, 1, False, XA_ATOM, &type, &format, &count, 
&remain, &winXdndVersion);
+                          0L, 1L, False, XA_ATOM, &type, &format, &count, 
&remain, &winXdndVersion);
 
        if (type != XA_ATOM || format != XDND_PROPERTY_FORMAT || count == 0 || 
!winXdndVersion) {
                if (winXdndVersion)
@@ -717,7 +717,7 @@ static void storeDestinationProtocolVersion(WMDraggingInfo 
* info)
 
        if (XGetWindowProperty(scr->display, XDND_DEST_WIN(info),
                               scr->xdndAwareAtom,
-                              0, 1, False, XA_ATOM, &type, &format,
+                              0L, 1L, False, XA_ATOM, &type, &format,
                               &count, &remain, &winXdndVersion) == Success) {
                XDND_DEST_VERSION(info) = *winXdndVersion;
                XFree(winXdndVersion);
diff --git a/WINGs/selection.c b/WINGs/selection.c
index ce93d22..afce194 100644
--- a/WINGs/selection.c
+++ b/WINGs/selection.c
@@ -250,7 +250,7 @@ static WMData *getSelectionData(Display * dpy, Window win, 
Atom where)
        int bits, bpi;
        unsigned long len, bytes;
 
-       if (XGetWindowProperty(dpy, win, where, 0, MAX_PROPERTY_SIZE,
+       if (XGetWindowProperty(dpy, win, where, 0L, MAX_PROPERTY_SIZE,
                               False, AnyPropertyType, &rtype, &bits, &len, 
&bytes, &data) != Success) {
                return NULL;
        }
diff --git a/src/properties.c b/src/properties.c
index 76f29ed..cd70484 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -117,14 +117,14 @@ unsigned char *PropGetCheckProperty(Window window, Atom 
hint, Atom type, int for
        unsigned long nitems_ret;
        unsigned long bytes_after_ret;
        unsigned char *data;
-       int tmp;
+       long tmp;
 
        if (count <= 0)
                tmp = 0xffffff;
        else
-               tmp = count;
+               tmp = (long *)count;
 
-       if (XGetWindowProperty(dpy, window, hint, 0, tmp, False, type,
+       if (XGetWindowProperty(dpy, window, hint, 0L, tmp, False, type,
                               &type_ret, &fmt_ret, &nitems_ret, 
&bytes_after_ret,
                               (unsigned char **)&data) != Success || !data)
                return NULL;
diff --git a/src/window.c b/src/window.c
index cb9b81b..475cbb9 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2488,7 +2488,7 @@ static int getSavedState(Window window, WSavedState ** 
state)
        unsigned long bytes_after_ret;
        CARD32 *data;
 
-       if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0, 10,
+       if (XGetWindowProperty(dpy, window, _XA_WINDOWMAKER_STATE, 0L, 10L,
                               True, _XA_WINDOWMAKER_STATE,
                               &type_ret, &fmt_ret, &nitems_ret, 
&bytes_after_ret,
                               (unsigned char **)&data) != Success || !data)
diff --git a/src/wmspec.c b/src/wmspec.c
index 87c0a19..5edb3ad 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -889,7 +889,7 @@ static Bool updateStrut(WWindow * wwin, Bool adding)
                unsigned long bytes_after_ret;
                long *data = 0;
 
-               if (XGetWindowProperty(dpy, wwin->client_win, net_wm_strut, 0, 
4, False,
+               if (XGetWindowProperty(dpy, wwin->client_win, net_wm_strut, 0L, 
4L, False,
                                       XA_CARDINAL, &type_ret, &fmt_ret, 
&nitems_ret,
                                       &bytes_after_ret, (unsigned char 
**)&data) == Success && data) {
 
@@ -1202,7 +1202,7 @@ static void updateWindowType(WWindow * wwin)
        unsigned long bytes_after_ret;
        long *data = 0;
        int layer;
-       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_window_type, 0, 1,
+       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_window_type, 0L, 
1L,
                               False, XA_ATOM, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
 
@@ -1232,7 +1232,7 @@ Bool wNETWMCheckClientHints(WWindow * wwin, int *layer, 
int *workspace)
        Bool hasState = False;
        int i;
 
-       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_desktop, 0, 1, 
False,
+       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_desktop, 0L, 1L, 
False,
                               XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
 
@@ -1247,7 +1247,7 @@ Bool wNETWMCheckClientHints(WWindow * wwin, int *layer, 
int *workspace)
                hasState = True;
        }
 
-       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_state, 0, 1, False,
+       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_state, 0L, 1L, 
False,
                               XA_ATOM, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
 
@@ -1259,7 +1259,7 @@ Bool wNETWMCheckClientHints(WWindow * wwin, int *layer, 
int *workspace)
                hasState = True;
        }
 
-       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_window_type, 0, 1, 
False,
+       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_window_type, 0L, 
1L, False,
                               XA_ATOM, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
 
@@ -1293,7 +1293,7 @@ static Bool updateNetIconInfo(WWindow * wwin)
        Bool hasState = False;
        Bool old_state = wwin->flags.net_handle_icon;
 
-       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_handled_icons, 0, 
1, False,
+       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_handled_icons, 0L, 
1L, False,
                               XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
                long handled = *data;
@@ -1304,7 +1304,7 @@ static Bool updateNetIconInfo(WWindow * wwin)
        } else
                wwin->flags.net_handle_icon = False;
 
-       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_icon_geometry, 0, 
4, False,
+       if (XGetWindowProperty(dpy, wwin->client_win, net_wm_icon_geometry, 0L, 
4L, False,
                               XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
 
@@ -1363,7 +1363,7 @@ static void handleDesktopNames(XClientMessageEvent * 
event, WScreen * scr)
        int fmt_ret, i, n;
        Atom type_ret;
 
-       if (XGetWindowProperty(dpy, scr->root_win, net_desktop_names, 0, 1, 
False,
+       if (XGetWindowProperty(dpy, scr->root_win, net_desktop_names, 0L, 1L, 
False,
                               utf8_string, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) != 
Success) {
                return;
@@ -1534,7 +1534,7 @@ int wNETWMGetPidForWindow(Window window)
        long *data = 0;
        int pid;
 
-       if (XGetWindowProperty(dpy, window, net_wm_pid, 0, 1, False,
+       if (XGetWindowProperty(dpy, window, net_wm_pid, 0L, 1L, False,
                               XA_CARDINAL, &type_ret, &fmt_ret, &nitems_ret,
                               &bytes_after_ret, (unsigned char **)&data) == 
Success && data) {
 
diff --git a/src/xdnd.c b/src/xdnd.c
index c8119fa..5ae1d7b 100644
--- a/src/xdnd.c
+++ b/src/xdnd.c
@@ -104,7 +104,7 @@ Bool wXDNDProcessSelection(XEvent * event)
 
        XGetWindowProperty(dpy, event->xselection.requestor,
                           _XA_WINDOWMAKER_XDNDEXCHANGE,
-                          0, 65536, True, atom_support, &ret_type, &ret_format,
+                          0L, 65536L, True, atom_support, &ret_type, 
&ret_format,
                           &ret_item, &remain_byte, (unsigned char **)&delme);
        if (delme) {
                scr->xdestring = delme;
@@ -191,7 +191,7 @@ Bool isAwareXDND(Window window)
        if (!window)
                return False;
        XGetWindowProperty(dpy, window, _XA_XdndAware,
-                          0, 0x8000000L, False, XA_ATOM, &actual, &format, 
&count, &remaining, &data);
+                          0L, 0x8000000L, False, XA_ATOM, &actual, &format, 
&count, &remaining, &data);
        if (actual != XA_ATOM || format != 32 || count == 0 || !data) {
                if (data)
                        XFree(data);
diff --git a/util/wxpaste.c b/util/wxpaste.c
index 4a923b7..5a6fd54 100644
--- a/util/wxpaste.c
+++ b/util/wxpaste.c
@@ -134,7 +134,7 @@ char *fetchSelection(Display * dpy, char *selection, char 
*progName)
                unsigned long len, bytes;
                unsigned char *data;
 
-               if (XGetWindowProperty(dpy, win, clipatom, 0, MAXDATA / 4, 
False,
+               if (XGetWindowProperty(dpy, win, clipatom, 0L, MAXDATA / 4, 
False,
                                       XA_STRING, &rtype, &bits, &len, &bytes, 
&data) != 0)
                        return NULL;
 
-- 
1.6.4.183.g04423


-- 
To unsubscribe, send mail to [email protected].

Reply via email to