Weird Crash
Felix-The-Ghost

I'm porting a program made in Windows to MacOSX.

al_show_native_message_box(NULL, "SIGABRT", "This line crashes the program", 0, 0, ALLEGRO_MESSAGEBOX_ERROR);

osx_dialog.m : _al_show_native_message_box
[box setInformativeText:[NSString stringWithUTF8String: al_cstr(fd->mb_text)]];

#SelectExpand
12015-05-03 21:34:45.310 Game[15773:5607] An uncaught exception was raised 22015-05-03 21:34:45.311 Game[15773:5607] *** +[NSString stringWithUTF8String:]: NULL cString 32015-05-03 21:34:45.313 Game[15773:5607] ( 4 0 CoreFoundation 0x00007fff8b354f56 __exceptionPreprocess + 198 5 1 libobjc.A.dylib 0x00007fff89db7d5e objc_exception_throw + 43 6 2 CoreFoundation 0x00007fff8b354d8a +[NSException raise:format:arguments:] + 106 7 3 CoreFoundation 0x00007fff8b354d14 +[NSException raise:format:] + 116 8 4 Foundation 0x00007fff88ebd630 +[NSString stringWithUTF8String:] + 76 9 5 Game 0x000000010bf82173 _al_show_native_message_box + 307 10 6 Game 0x000000010bf81beb al_show_native_message_box + 139 11 7 Game 0x000000010bf2dbe5 _ZN8gamedata7processEv + 789 12 8 Game 0x000000010bf255fc _al_mangled_main + 236 13 9 Game 0x000000010bfdf237 +[AllegroAppDelegate app_main:] + 23 14 10 Foundation 0x00007fff88f1272a -[NSThread main] + 68 15 11 Foundation 0x00007fff88f126a2 __NSThread__main__ + 1575 16 12 libsystem_c.dylib 0x00007fff885ec8bf _pthread_start + 335 17 13 libsystem_c.dylib 0x00007fff885efb75 thread_start + 13 18) 192015-05-03 21:34:45.351 Armor[15773:5607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString' 20*** First throw call stack: 21( 22 0 CoreFoundation 0x00007fff8b354f56 __exceptionPreprocess + 198 23 1 libobjc.A.dylib 0x00007fff89db7d5e objc_exception_throw + 43 24 2 CoreFoundation 0x00007fff8b354d8a +[NSException raise:format:arguments:] + 106 25 3 CoreFoundation 0x00007fff8b354d14 +[NSException raise:format:] + 116 26 4 Foundation 0x00007fff88ebd630 +[NSString stringWithUTF8String:] + 76 27 5 Game 0x000000010bf82173 _al_show_native_message_box + 307 28 6 Game 0x000000010bf81beb al_show_native_message_box + 139 29 7 Game 0x000000010bf2dbe5 _ZN8gamedata7processEv + 789 30 8 Game 0x000000010bf255fc _al_mangled_main + 236 31 9 Game 0x000000010bfdf237 +[AllegroAppDelegate app_main:] + 23 32 10 Foundation 0x00007fff88f1272a -[NSThread main] + 68 33 11 Foundation 0x00007fff88f126a2 __NSThread__main__ + 1575 34 12 libsystem_c.dylib 0x00007fff885ec8bf _pthread_start + 335 35 13 libsystem_c.dylib 0x00007fff885efb75 thread_start + 13 36) 37terminate called throwing an exception(lldb)

Although I had trouble configuring the project in Xcode, everything else appears to work just as it did under Windows (events, graphics, sounds, file i/o all work)

Do I need to rebuild Allegro?

SiegeLord

I don't think it's valid to set the text parameter to NULL like you do (it's the 4th parameter).

Felix-The-Ghost

Amazing all the bugs (with your own code) you find when you switch OS :D
I swear that is the same code I used in Windows and it worked exactly how I thought it would :/

Under OSX:
al_show_native_message_box(NULL, "Title", "Heading", "Text", 0, ALLEGRO_MESSAGEBOX_ERROR);

produces:

{"name":"Screen_Shot_2015_05_03_at_11_52_52_PM.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/5\/357a2398a433e0aaba66f930d41b82f0.png","w":433,"h":165,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/3\/5\/357a2398a433e0aaba66f930d41b82f0"}Screen_Shot_2015_05_03_at_11_52_52_PM.png

What happens to the heading?

SiegeLord

OSX only has those two fields to customize... I suppose Allegro should do something smarter than just silently dropping it though.

Thread #615338. Printed from Allegro.cc