![]() |
|
al_get_target_bitmap returning a destroyed bitmap |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
This is a continuation of an older thread that got locked (https://www.allegro.cc/forums/thread/615871). I am still trying to debug a crash in my ManyMouse project where it crashes in al_hold_bitmap_drawing(false). I am using al_hold_bitmap_drawing(false); because before my code was crashing on a failed assert when Allegro calls ASSERT(!al_is_bitmap_drawing_held()). When I don't call al_hold_bitmap_drawing(false) though, it crashes on al_set_target_bitmap (but not reliably). Here is a backtrace : 1
2c:\Research\RawInput\RainDropMouse\ManyMouse\cbbuild\bin>gdb RawDebug.exe
3GNU gdb (GDB) 7.6.1
4Copyright (C) 2013 Free Software Foundation, Inc.
5License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
6This is free software: you are free to change and redistribute it.
7There is NO WARRANTY, to the extent permitted by law. Type "show copying"
8and "show warranty" for details.
9This GDB was configured as "mingw32".
10For bug reporting instructions, please see:
11<http://www.gnu.org/software/gdb/bugs/>...
12Reading symbols from c:\Research\RawInput\RainDropMouse\ManyMouse\cbbuild\bin\RawDebug.exe...done.
13(gdb) run
14Starting program: c:\Research\RawInput\RainDropMouse\ManyMouse\cbbuild\bin/RawDebug.exe
15[New Thread 1024.0x1680]
16Thread ID of main function is 0x00001680
17[New Thread 1024.0xafc]
18CreateAllegroBitmap : Created 16 X 24 allegro bitmap fcfs_mouse_buffer at 0028f140 on thread 5760 attached to display 00000000
19Hook dll loaded successfully
20LowLevelMouseHook loaded successfully.
21MouseHook loaded successfully.
22StartMouse loaded successfully.
23StopMouse loaded successfully.
24SetWindowsHookEx(WH_MOUSE_LL) succeeded.
25SetWindowsHookEx(WH_MOUSE) succeeded.
26ShellHook loaded successfully
27SetWindowsHookEx(WH_SHELL) succeeded
28log.InitMutex() returned true
29InitTree() returned true
30BFD: C:\Windows\system32\atiumdva.dll: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .text
31BFD: C:\Windows\system32\atiumdva.dll: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .rdata
32BFD: C:\Windows\system32\atiumdva.dll: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .data
33[New Thread 1024.0x1320]
34[New Thread 1024.0x1764]
35[New Thread 1024.0x6ec]
36[New Thread 1024.0xf6c]
37[New Thread 1024.0xd08]
38[New Thread 1024.0x11e0]
39CreateAllegroDisplay : Created 640 X 400 allegro display RawInputHandler::display at 029f1b68 on thread 5760 with backbuffer 029f1dc0
40CreateAllegroBitmap : Created 1280 X 800 allegro bitmap RawInputHandler::allegro_buffer at 029f8cb8 on thread 5760 attached to display 029f1b68
41[New Thread 1024.0x844]
42[New Thread 1024.0x143c]
43[New Thread 1024.0x1110]
44CreateAllegroDisplay : Created 1024 X 300 allegro display RawInputHandler::log_display at 029f96e0 on thread 5760 with backbuffer 029f9938
45Images loaded successfully
46Couldn't set WS_EX_LAYERED style attribute
47Thread ID of callback process is 0x00001320
48WindowHandler::EnumerateWindows After EnumerateTree
49Desktop window handle = 00010010
50Shell window handle = 000200e8
51Taskbar window handle = 00010054
52Num raw input devices detected = 13
53InitRawInfo was successful
54RegisterDevices was successful
55[New Thread 1024.0x133c]
56Adding mouse device #1
57[New Thread 1024.0x16a8]
58[New Thread 1024.0x11cc]
59[New Thread 1024.0x10b8]
60[New Thread 1024.0xd48]
61Adding mouse device #2
62[New Thread 1024.0x14a0]
63[New Thread 1024.0x10f0]
64[New Thread 1024.0x438]
65[New Thread 1024.0x1398]
66FCFS DrawPointers : Setting image for mouse device #1
67[New Thread 1024.0x938]
68[New Thread 1024.0x17f8]
69[New Thread 1024.0x1418]
70[New Thread 1024.0x11d8]
71FCFS DrawPointers : Setting image for mouse device #2
72[New Thread 1024.0x13e4]
73[New Thread 1024.0xe40]
74[New Thread 1024.0x17e4]
75[New Thread 1024.0x1424]
76
77Program received signal SIGSEGV, Segmentation fault.
78[Switching to Thread 1024.0x1320]
790x67720969 in al_hold_bitmap_drawing (hold=false) at C:\mingw\LIBS\A5112release\allegro\src\display.c:520
80520 current_display->vt->flush_vertex_cache(current_display);
81(gdb) bt
82#0 0x67720969 in al_hold_bitmap_drawing (hold=false) at C:\mingw\LIBS\A5112release\allegro\src\display.c:520
83#1 0x648823aa in AllegroSetTargetBitmap (bmp=0x2ac5d88, name=0x648a2194 <MouseController::SetMouseStrategy(MOUSE_STRATEGY)::__func__+1173> "fcfs_mouse_buffer") at C:\Research\RawInput\RainDropMouse\ManyMouse\src\AllegroAndWindows.cpp:517
84#2 0x648855cd in FCFSMouseStrategy::DrawPointers (this=0x22fa98, strategy_state=FCFS_STATE_PROCESSING_CLICK) at C:\Research\RawInput\RainDropMouse\ManyMouse\src\MouseStrategyFCFS.cpp:159
85#3 0x64885929 in FCFSMouseStrategy::SetFCFSStrategyState (this=0x22fa98, new_state=FCFS_STATE_PROCESSING_CLICK) at C:\Research\RawInput\RainDropMouse\ManyMouse\src\MouseStrategyFCFS.cpp:215
86#4 0x6488509b in FCFSMouseStrategy::HandleInput (this=0x22fa98, input=..., process_input=true) at C:\Research\RawInput\RainDropMouse\ManyMouse\src\MouseStrategyFCFS.cpp:83
87#5 0x64884f48 in FCFSMouseStrategy::HandleInput (this=0x22fa98, input=...) at C:\Research\RawInput\RainDropMouse\ManyMouse\src\MouseStrategyFCFS.cpp:49
88#6 0x648840bb in MouseController::HandleRawInput (this=0x22fa78, rawinput=...) at C:\Research\RawInput\RainDropMouse\ManyMouse\src\MouseController.cpp:156
89#7 0x00404651 in _fu68___ZN9ManyMouse3logE () at C:\Research\RawInput\RainDropMouse\ManyMouse\src\RawInputHandler.cpp:1408
90#8 0x00404264 in _fu60___ZN9ManyMouse3logE () at C:\Research\RawInput\RainDropMouse\ManyMouse\src\RawInputHandler.cpp:1210
91#9 0x0040177a in _fu0___ZN9ManyMouse3logE () at C:\Research\RawInput\RainDropMouse\ManyMouse\src\RawInputHandler.cpp:44
92#10 0x6779cf46 in window_callback (hWnd=0xa0a3e, message=255, wParam=0, lParam=4008103) at C:\mingw\LIBS\A5112release\allegro\src\win\wwindow.c:428
93#11 0x75eef8d2 in USER32!GetMessageW () from C:\Windows\system32\user32.dll
94#12 0x75eef794 in USER32!GetWindowLongW () from C:\Windows\system32\user32.dll
95#13 0x6779cd3f in accept_mouse_event () at C:\mingw\LIBS\A5112release\allegro\src\win\wwindow.c:372
96#14 0x000a0a3e in ?? ()
97#15 0x000000ff in ?? ()
98#16 0x00000000 in ?? ()
99(gdb) bt 3 full
100#0 0x67720969 in al_hold_bitmap_drawing (hold=false) at C:\mingw\LIBS\A5112release\allegro\src\display.c:520
101 current_display = 0x2a94ef8
102#1 0x648823aa in AllegroSetTargetBitmap (bmp=0x2ac5d88, name=0x648a2194 <MouseController::SetMouseStrategy(MOUSE_STRATEGY)::__func__+1173> "fcfs_mouse_buffer") at C:\Research\RawInput\RainDropMouse\ManyMouse\src\AllegroAndWindows.cpp:517
103No locals.
104#2 0x648855cd in FCFSMouseStrategy::DrawPointers (this=0x22fa98, strategy_state=FCFS_STATE_PROCESSING_CLICK) at C:\Research\RawInput\RainDropMouse\ManyMouse\src\MouseStrategyFCFS.cpp:159
105 m = 0x2a228f8
106 i = 0
107 __func__ = "DrawPointers"
108 image = 0x0
109 mouse_vec = {<std::_Vector_base<Mouse*, std::allocator<Mouse*> >> = {_M_impl = {<std::allocator<Mouse*>> = {<__gnu_cxx::new_allocator<Mouse*>> = {<No data fields>}, <No data fields>}, _M_start = 0x2a8bff8, _M_finish = 0x2a8c000, _M_end_of_storage = 0x2a8c000}}, <No data fields>}
110(More stack frames follow...)
111(gdb) p al_get_current_display()
112$1 = (struct ALLEGRO_DISPLAY *) 0x2a94ef8
113(gdb) p PrintUserResources()
114$2 = void
115(gdb)
From my program's log and resource tracking I can see that the ALLEGRO_DISPLAY* at 0x2a94ef8 has already been destroyed. So for some reason _al_get_current_display is returning a destroyed display, and I can't figure out why. If anyone wants to look at my code or try debugging this, PM me your email, and I'll send you a read only invitation to my bitbucket repository. It only builds with MinGW and CodeBlocks atm, and it's windows only (XP or higher). It needs Allegro 5.1.12 or later, and the patch for Allegro I provided here (https://www.allegro.cc/forums/thread/615913/1018200#target). Edit My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Niunio
Member #1,975
March 2002
![]() |
Just wondering: Did you put a break on "al_destroy_display" to see if it's called somewhere? ----------------- |
|