Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » al_create_display crash

This thread is locked; no one can reply to it. rss feed Print
al_create_display crash
shadyvillian
Member #12,426
December 2010

When I create display a for the second time i keep getting a seg fault(note: this is a secondary window created on a mouse click). when the user exits the window i call al_destroy_display() then recreate it when they want to open it. what causes a a program to crash on al_create_display other than not calling al_init()? heres the call stack:

#0 77450475 ntdll!TpWaitForAlpcCompletion() (C:\Windows\system32\ntdll.dll:??)
#1 00000000 0x0028e8f8 in ??() (??:??)
#2 7740A5FD ntdll!AlpcMaxAllowedMessageLength() (C:\Windows\system32\ntdll.dll:??)
#3 00000000 0x02b349c0 in ??() (??:??)
#4 773B3587 ntdll!RtlFindClearRuns() (C:\Windows\system32\ntdll.dll:??)
#5 0000007F ??() (z:/programs/codeblocks/mingw/bin/../lib/gcc/mingw32/4.5.2/include/c++/bits/stl_vector.h:247)
#6 00000000 0x00000938 in ??() (??:??)
#7 00000000 0x0028e9c0 in ??() (??:??)
#8 773B3472 ntdll!RtlLargeIntegerShiftRight() (C:\Windows\system32\ntdll.dll:??)
#9 00000000 0x02b34918 in ??() (??:??)
#10 7745162E ntdll!RtlValidateHeap() (C:\Windows\system32\ntdll.dll:??)
#11 00000000 0x00b10000 in ??() (??:??)
#12 7740AB3A ntdll!AlpcMaxAllowedMessageLength() (C:\Windows\system32\ntdll.dll:??)
#13 00000000 0x00b10000 in ??() (??:??)
#14 773B3472 ntdll!RtlLargeIntegerShiftRight() (C:\Windows\system32\ntdll.dll:??)
#15 00000000 0x02b34918 in ??() (??:??)
#16 764598CD msvcrt!free() (C:\Windows\syswow64\msvcrt.dll:??)
#17 00000000 0x00b10000 in ??() (??:??)
#18 004824E4 d3d_create_display_internals(ALLEGRO_DISPLAY_D3D*) () (??:??)
#19 00482DB7 d3d_create_display_locked(int, int) () (??:??)
#20 00484D5F d3d_create_display(int, int) () (??:??)
#21 00000000 0x00430f9e in al_create_display() (??:??)
#22 0041A744 _StatisticsModule::Initialize(this=0x28f948)
#23 004059F0 Core::HandleMouseClicks(this=0x28f748)
#24 0041DD68 Core::Run(this=0x28f748)
#25 00412855 main()

heres the function:

#SelectExpand
1int _StatisticsModule::Initialize() 2{ 3 Screen = NULL; 4 EventQueue = NULL; 5 6 int xpos = (al_get_display_width(al_get_current_display())/2)-272, ypos = (al_get_display_height(al_get_current_display())/2)-295; 7 int x = 0, y = 0; 8 al_get_window_position(al_get_current_display(), &x, &y); 9 10 Screen = al_create_display(545, 590); //crash on this line 11 if(!Screen) 12 { 13 return ShowMessageBox(al_get_current_display(), "Error", "Failed to create screen", ALLEGRO_MESSAGEBOX_ERROR); 14 } 15 16 al_set_window_position(Screen, x+xpos, y+ypos); 17 al_set_window_title(Screen, "Statistics"); 18 al_set_target_backbuffer(Screen); 19 20 EventQueue = al_create_event_queue(); 21 RedrawTimer = al_create_timer(1.0 / 60); 22 23 al_register_event_source(EventQueue, al_get_keyboard_event_source()); 24 al_register_event_source(EventQueue, al_get_mouse_event_source()); 25 al_register_event_source(EventQueue, al_get_display_event_source(Screen)); 26 al_register_event_source(EventQueue, al_get_timer_event_source(RedrawTimer)); 27 28 if(LoadContent() == -1) 29 { 30 return -1; 31 } 32 33 return 0; 34}

Software Engineer by day, hacker by night.

Go to: