[A5] al_create_native_file_dialog() crashes
ehguacho

hi! me again. i'm having some issues with the al_create_native_file_dialog() function. what i'm trying to do is to show a dialog to open file, like file_select_ex() for the old A4. for some reason wich i don't know, mi app crashes while calling the al_create_native_file_dialog() function.

ALLEGRO_FILECHOOSER *OpenFile = al_create_native_file_dialog("C:\\", "Open File", NULL, ALLEGRO_FILECHOOSER_FILE_MUST_EXIST);

i know that's an OS native function, so i must say that i'm using Win7. what am i doing wrong?

thank you all in advance!

Matthew Leverton

Try "*.*" as the third parameter.

ehguacho

tried that already, and didn't work. also i tried it by modifying the fourth parameter, but no luck neither.

Matthew Leverton

It shouldn't crash. You'll probably have to walk through the Allegro code with a debugger.

ehguacho

and how should i do that? i'm using code::blocks 10.05.

Edgar Reynaldo

Code::Blocks is your IDE, not your compiler. I'm guessing you're using MinGW, so you need to download gdb from the sourceforge site for MinGW. The latest version of gdb also requires some runtime library which I can't remember at the moment. You can also find it at sourceforge in the MinGW project.

Once you have gdb installed to your path (or your path adjusted to include the directory where gdb is) ((putting it in mingw/bin is probably the best option)), then you run your program through gdb. (You'll need to compile your program with debugging symbols, and link to the debugging version of Allegro).

gdb my_program.exe
>...
>run
CRASH!
>backtrace
0 function 0x0000blah from sourcefile.c line 123
1 ...
2 ...
...

What we need is to see the results of the backtrace.

Matthew Leverton

The only reason why it "should" crash is if you haven't initialized Allegro. So if you are doing that, then proceed to debug.

Thread #607954. Printed from Allegro.cc