| Summary: | Crashes in Cocoa_SetWindowTitle | ||
|---|---|---|---|
| Product: | SDL | Reporter: | David Ludwig <dll> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | dll |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Mac OS X 10.8 | ||
| Attachments: |
a sample program to reproduce SDL Bug 3048
call-stack of crash Here's a screenshot of Xcode showing where the crash occurs similar crash-inducing code fix for forementioned crashes |
||
|
Description
David Ludwig
2015-07-04 20:52:42 UTC
Created attachment 2212 [details] a sample program to reproduce SDL Bug 3048 Created attachment 2213 [details]
call-stack of crash
Created attachment 2214 [details]
Here's a screenshot of Xcode showing where the crash occurs
The crash appears to occur because the window's title is unset, and Cocoa_SetWindowTitle makes an attempt to create an NSString from the NULL, 'window->title'.
Created attachment 2215 [details]
similar crash-inducing code
I noticed that a similar set of code can cause crashes on OS X, this time using a windowed-mode SDL_Window. Attached is a sample program, that will crash on OS X (in SDL HG, same changeset as before).
Created attachment 2216 [details]
fix for forementioned crashes
Here is a Mercurial-generated patch to address the fore-mentioned crashes (in Cocoa_SetWindowTitle).
If this patch looks okay to you all, I'd be happy to push it out to hg.libsdl.org/SDL, if it'd help.
Fixed, thanks! https://hg.libsdl.org/SDL/rev/e0db4fedf80c Actually I added a more general fix here: https://hg.libsdl.org/SDL/rev/c142db5785ad Cool. :-) I wasn't sure if a fix like that was kosher or not; a few other backends' SetWindowTitle implementations access window->title directly. On a secondary inspection of them, I don't see any other sources for window->title crashes. The OSX/Cocoa video backend appears to be the only one that accesses its SetWindowTitle implementation (Cocoa_SetWindowTitle) directly. All others appear to only be called via SDL_SetWindowTitle and SDL_RecreateWindow, which do their own NULL checks. |