Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed bug #329
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Sep 23, 2006
1 parent 7ad322f commit a759fb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/SDL_compat.h
Expand Up @@ -147,7 +147,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *
surface);
extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title,
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 int SDLCALL SDL_WM_IconifyWindow(void);
extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface * surface);
Expand Down
7 changes: 5 additions & 2 deletions src/SDL_compat.c
Expand Up @@ -692,14 +692,17 @@ SDL_WM_SetCaption(const char *title, const char *icon)
{
if (wm_title) {
SDL_free(wm_title);
} else {
}
if (title) {
wm_title = SDL_strdup(title);
} else {
wm_title = NULL;
}
SDL_SetWindowTitle(SDL_VideoWindow, wm_title);
}

void
SDL_WM_GetCaption(char **title, char **icon)
SDL_WM_GetCaption(const char **title, const char **icon)
{
if (title) {
*title = wm_title;
Expand Down

0 comments on commit a759fb0

Please sign in to comment.