| Summary: | MessageBox crash | ||
|---|---|---|---|
| Product: | SDL | Reporter: | simon.guilliams |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.7 | ||
| Hardware: | x86_64 | ||
| OS: | macOS 10.12 | ||
| Attachments: | OCaml Program that crashes if you hold ESC key for 30 seconds. | ||
It looks like this might be a race condition in the bindings. Do you get the same thing if you use show_simple_message_box? Simple message boxes do not have a default action on "Escape" key, so I replaced the Escape keydown event by a Return keydown event in order to have a repetition. It seems to work - held two minutes without problem. The "complex" message box does crash with the Return repetition. By binding, you mean the tsdl binding, not the ocaml bindings, right? The source of tsdl 'show_message_box' is here: https://github.com/dbuenzli/tsdl/blob/master/src/tsdl.ml#L2386 Yes, that's what I meant. As far as I can tell this is an issue with the bindings, not the SDL code, and can't be fixed by us. |
Created attachment 3156 [details] OCaml Program that crashes if you hold ESC key for 30 seconds. Hello I wrote an OCaml program that opens a window using SDL and one of it's OCaml binding, Tsdl. When the user presses the "Escape" key, the program does open a message box with SDL_ShowMessageBox. The dialog asks the user if he wants to quit the application. There are two buttons: - One that exits the application. It is the default button when "Return" key is pressed. - One that does nothing (Cancel). It is the default button when "Escape" key is pressed (again). When the user holds the "ESC" key pressed, the dialog shows up, then it closes (Cancel), then shows up again, etc. This is normal because the "ESC" key is repeated. In a good application I would prevent this repetition, but for the sake of the bug report I leave it as is. While holding the ESC key, the program crashes in average under 30 seconds. The bug is reproducible: it happens every time, sometimes in seconds, sometimes after a minute (maximum). The crash is a sigabort: *** Terminating app due to uncaught exception 'NSInvalidArgumentException' *** The full crash dump is below this post. Once (and only once) it had a segmentation fault. I cannot reproduce this as it is too random. I don't know whether this bug affects SDL, Tsdl, Ocaml ctypes, or Cocoa. I tried to create a Minimal, Complete, and Verifiable example. It is an small 100 hundred lines of code OCaml program with Tsdl as a dependency. I am attaching it to this bug report. You should install Tsdl with opam. The compile instruction is in the source. I cannot provide a core dump as I am not root on the macOS computer I use. Note that with Tsdl, buttons can be the default action for "Escape" or "Return" key. Tsdl is missing a "No default action" option. Full crash dump: 2018-01-29 13:59:54.649 a.out[1257:47645508] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSConcreteAttributedString initWithString:: nil value' *** First throw call stack: ( 0 CoreFoundation 0x00007fff7774657b __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fff8c9a51da objc_exception_throw + 48 2 CoreFoundation 0x00007fff777c3c55 +[NSException raise:format:] + 197 3 Foundation 0x00007fff79117984 -[NSConcreteAttributedString initWithString:] + 135 4 AppKit 0x00007fff7547fd2d -[NSAlert setMessageText:] + 56 5 libSDL2-2.0.0.dylib 0x000000010361d510 Cocoa_ShowMessageBox + 188 6 libSDL2-2.0.0.dylib 0x000000010361a3c8 SDL_ShowMessageBox_REAL + 255 7 libffi.6.dylib 0x0000000103675914 ffi_call_unix64 + 76 8 ??? 0x00007fff5c8803a0 0x0 + 140734745805728 ) libc++abi.dylib: terminating with uncaught exception of type NSException [1] 1257 abort ./a.out Cheers