[AD] remove_mouse crash in allegro_exit (was: Problem with remove_mouse() and video bitmaps)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Peter Wang wrote:
> > >+   Note: you must not be showing a mouse pointer on a bitmap at the time 
> > >that
> > >+   the bitmap is destroyed with destroy_bitmap(). This does not apply to
> > >+   `screen' since you never destroy `screen' with destroy_bitmap().
> 
> Done.  I gave show_mouse(NULL) as an _example_ since, strictly speaking,
> the problem is also avoided by showing the mouse to an another, distinct
> bitmap.

I'm experiencing a crash/hang when exiting an allegro program, see the
following backtrace:

#0  0xffffe410 in __kernel_vsyscall ()
#1  0xa7bf66d1 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xa7bf7f9b in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xa7c2d157 in __fsetlocking () from /lib/tls/i686/cmov/libc.so.6
#4  0xa7c3384c in malloc_usable_size () from
#/lib/tls/i686/cmov/libc.so.6
#5  0xa7c33bc2 in free () from /lib/tls/i686/cmov/libc.so.6
#6  0xa7e61772 in destroy_bitmap (bitmap=0x8104a90) at
#./src/graphics.c:1485
#7  0xa7e85445 in remove_mouse () at ./src/mouse.c:1162
#8  0xa7e30e44 in allegro_exit () at ./src/allegro.c:420
#9  0x0806946c in shutdown () at init.cc:269
#10 0x080692b9 in main (argc=1, argv=0xaff0f144) at main.cc:36

This gives a *** glibc double free *** error, which is apparently
caused by free()ing the mouse bitmap during allegro_exit.  The
previous thread gave me the idea to try a show_mouse(NULL) before
exiting the program, which indeed seems to fix the crash.

Is it perhaps a good idea to have allegro_exit call show_mouse(NULL)
before calling remove_mouse?

       Hein Zelle

>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-< 
 Unix is user friendly. It's just very particular about who 
 it's friends are.

 Hein Zelle                     hein@xxxxxxxxxx
	                        http://www.icce.rug.nl/~hein
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-<




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/