On Friday 01 April 2011 02:12:31 Matthias Kilian wrote:
> On Fri, Apr 01, 2011 at 01:25:17AM +0300, Antti Harri wrote:
> > I compiled this from ports on amd64 and every time when I exit the game I
> > get:
> >
> > % blobwars
> > blobwars in free(): error: chunk is already free 0x2101d7b80
> > zsh: abort (core dumped)  blobwars
>
> Could you please rebuild it with debugging symbols?
>
> $ amke clean="package bulk update"
> $ env DEBUG=-g make update-or-install
>
> After this, you should be able to get a backtrace with gdb.
>
> Ciao,
>       Kili

(gdb) bt
#0  0x00000002079e33fa in kill () from /usr/lib/libc.so.58.0
#1  0x0000000207a3e4a1 in abort () at /usr/src/lib/libc/stdlib/abort.c:68
#2  0x0000000207a3bf65 in wrterror (msg=Variable "msg" is not available.) at 
/usr/src/lib/libc/stdlib/malloc.c:387
#3  0x0000000207a3d48d in free (ptr=0x20e5e5d00) at 
/usr/src/lib/libc/stdlib/malloc.c:1328
#4  0x000000020625178c in SDL_JoystickClose () from /usr/local/lib/libSDL.so.8.0
#5  0x000000000042824c in cleanup () at src/init.cpp:467
#6  0x0000000207a351e9 in __cxa_finalize (dso=0x0) at 
/usr/src/lib/libc/stdlib/atexit.c:153
#7  0x0000000207a1809a in exit (status=0) at /usr/src/lib/libc/stdlib/exit.c:57
#8  0x000000000043ad14 in title () at src/title.cpp:424
#9  0x000000000043e1d3 in main (argc=1, argv=0x7f7ffffd5dd8) at src/main.cpp:203

The fault seems to be that it tries to close joysticks that I don't have at 
src/init.cpp:467.

This debug
for(int i=0;i<SDL_NumJoysticks();i++)
   printf("%s\n", SDL_JoystickName(i));

prints this:
/dev/uhid0
/dev/uhid1
/dev/uhid2

I have logitech's keyboard, so is this SDL's bug?

uhidev0 at uhub2 port 1 configuration 1 interface 0 "BTC USB Multimedia 
Keyboard" rev 1.10/1.30 addr 2
uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 modifier keys, 6 key codes
wskbd1 at ukbd0 mux 1
wskbd1: connecting to wsdisplay0
uhidev1 at uhub2 port 1 configuration 1 interface 1 "BTC USB Multimedia 
Keyboard" rev 1.10/1.30 addr 2
uhidev1: iclass 3/0, 3 report ids
uhid0 at uhidev1 reportid 1: input=1, output=0, feature=0
uhid1 at uhidev1 reportid 2: input=3, output=0, feature=0
uhid2 at uhidev1 reportid 3: input=3, output=0, feature=4

Attached is a patch that fixed the abort trap for me.

diff --git games/blobwars/Makefile games/blobwars/Makefile
index 43f9925..c65d04a 100644
--- games/blobwars/Makefile
+++ games/blobwars/Makefile
@@ -3,7 +3,7 @@
 COMMENT =      2D arcade game
 
 DISTNAME =     blobwars-1.18
-REVISION =     0
+REVISION =     1
 
 CATEGORIES =   games
 
diff --git games/blobwars/patches/patch-src_init_cpp 
games/blobwars/patches/patch-src_init_cpp
new file mode 100644
index 0000000..0675ced
--- /dev/null
+++ games/blobwars/patches/patch-src_init_cpp
@@ -0,0 +1,17 @@
+$OpenBSD$
+--- src/init.cpp.orig  Fri Apr  1 03:03:11 2011
++++ src/init.cpp       Fri Apr  1 03:29:23 2011
+@@ -461,9 +461,11 @@ void cleanup()
+       if (SDL_NumJoysticks() > 0)
+       {
+               SDL_JoystickEventState(SDL_DISABLE);
+-              for (int i = 0 ; i < SDL_NumJoysticks() ; i++)
++              // Blobwars tries to open only the first joystick,
++              // so test only the first here as well.
++              if (SDL_JoystickOpened(0))
+               {
+-                      debug(("Closing Joystick #%d - %s...\n", i, 
SDL_JoystickName(i)));
++                      debug(("Closing Joystick #%d - %s...\n", 0, 
SDL_JoystickName(0)));
+                       SDL_JoystickClose(config.sdlJoystick);
+               }
+       }

Reply via email to