Re: [SF] Bad argument



On Sat, 7 Aug 2010 09:28:17 +0200, "Mihai T. Lazarescu" wrote:
>> > Sometimes small error windows pop up with messages like:
>> > 
>> >     Bad argument: #<subr x-atom-name>, 1098346340, 1
>> > 
>> > when I use Java applications.

Hi, Mihai. 

1. Does the attached patch "atom.patch" fix? (It's already
in the git HEAD, but not included in any released versions.)

Its description:
* x-atom-name accepts full 32 unsigned int. Previously only 30 bits are
  treated, if the architecture is 32-bit.

I know it fixes one bug, but I'm not sure if it's related to your case.

If not,
2. Is your OS 32-bit? (see $ uname -a) Is your librep compiled
against gmp, a math lib? ($ ldd /usr/bin/rep)
3. Can you test the patch "print.patch", in addition to the above
patch? It prints to the standard error some info.
(I think it's enough to copy 
/usr/share/sawfish/1.6.1/lisp/sawfish/wm/state/wm-spec.jl
to ~/.sawfish/lisp/sawfish/wm/state, apply the patch to it,
and restart. If it doesn't print any, then please patch agaisnt the
installed file, and restart.)

Fortunately the same bug was reported in the debian bug tracker:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=406673
So it may give some hints.

# By the way, what's [SF] which is always present in your email
# subject? :)

Good luck,
Teika (Teika kazura)

diff --git a/src/functions.c b/src/functions.c
index 6047f5c..9c0817c 100644
--- a/src/functions.c
+++ b/src/functions.c
@@ -43,6 +43,7 @@
 #include "sawfish.h"
 #include <string.h>
 #include <X11/Xatom.h>
+#include <stdint.h>
 
 /* Number of outstanding server grabs made; only when this is zero is
    the server ungrabbed. */
@@ -922,8 +923,16 @@ Return the symbol with the same name as the X atom identified by the
 integer ATOM.
 ::end:: */
 {
-    rep_DECLARE1(atom, rep_INTP);
-    return x_atom_symbol (rep_INT(atom));
+  if(rep_INTP(atom)){
+    return x_atom_symbol(rep_INT(atom));
+  }
+  if(rep_INTEGERP(atom)){
+    return x_atom_symbol((uint32_t) rep_get_long_uint(atom));
+  }
+  /* This always returns an error. */
+  rep_DECLARE1(atom, rep_INTEGERP);
+  /* Just to make compiler silent. */
+  return Qnil;
 }
 
 DEFUN("root-window-id", Froot_window_id, Sroot_window_id, (void), rep_Subr0) /*
diff --git a/lisp/sawfish/wm/state/wm-spec.jl b/lisp/sawfish/wm/state/wm-spec.jl
index db9f101..78ae6ee 100644
--- a/lisp/sawfish/wm/state/wm-spec.jl
+++ b/lisp/sawfish/wm/state/wm-spec.jl
@@ -560,6 +560,7 @@
 
 	((_NET_WM_STATE)
 	 (when (windowp w)
+	   (format standard-error "%s: %s\n" (window-name w) data)
 	   (let ((mode (cond ((eql (aref data 0) _NET_WM_STATE_REMOVE)
                               'remove)
 			     ((eql (aref data 0) _NET_WM_STATE_ADD)
@@ -568,6 +569,8 @@
                               'toggle)))
 		 (atom1 (x-atom-name (aref data 1)))
 		 (atom2 (x-atom-name (aref data 2))))
+	     ;; If it doesn't reach here, then an error has happened.
+	     (format standard-error "atom1: %s, atom2: %s\n" atom1 atom2)
 	     (when (or (and (eq atom1 '_NET_WM_STATE_MAXIMIZED_VERT)
 			    (eq atom2 '_NET_WM_STATE_MAXIMIZED_HORZ))
 		       (and (eq atom2 '_NET_WM_STATE_MAXIMIZED_VERT)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]