Commit c18cc10c authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug #329

On tracing it turns out to fail from SDL_WM_SetCaption()

On going through the function it looks like the SDL_free() function is called
every alternate time with an invalid pointer that has already been freed.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402101
parent b8493a11
...@@ -147,7 +147,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface * ...@@ -147,7 +147,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
surface); surface);
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
const char *icon); const char *icon);
extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon); extern DECLSPEC void SDLCALL SDL_WM_GetCaption(const char **title, const char **icon);
extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask); extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask);
extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void); extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface); extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
......
...@@ -692,14 +692,17 @@ SDL_WM_SetCaption(const char *title, const char *icon) ...@@ -692,14 +692,17 @@ SDL_WM_SetCaption(const char *title, const char *icon)
{ {
if (wm_title) { if (wm_title) {
SDL_free(wm_title); SDL_free(wm_title);
} else { }
if (title) {
wm_title = SDL_strdup(title); wm_title = SDL_strdup(title);
} else {
wm_title = NULL;
} }
SDL_SetWindowTitle(SDL_VideoWindow, wm_title); SDL_SetWindowTitle(SDL_VideoWindow, wm_title);
} }
void void
SDL_WM_GetCaption(char **title, char **icon) SDL_WM_GetCaption(const char **title, const char **icon)
{ {
if (title) { if (title) {
*title = wm_title; *title = wm_title;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment