Cleaned up a couple of problems when DEBUG is defined.
Enabled fmemopen_alternative on Windows. Rearranged calls to rsvg_init()/rsvg_term() so that they are only called once at startup and shutdown. This was causing segfaults when opening SVG files and apparently it's not just Tux Paint: http://0pointer.de/blog/projects/beware-of-rsvg-term.html Slightly hysterical, but a quick Google search reveals other projects with the same problem/solution. Builds and runs on Windows again.
This commit is contained in:
parent
ef7d94dff9
commit
74c460d3f2
1 changed files with 17 additions and 11 deletions
|
|
@ -501,7 +501,7 @@ extern WrapperData macosx;
|
||||||
|
|
||||||
//#define fmemopen_alternative */ /* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
|
//#define fmemopen_alternative */ /* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
|
||||||
|
|
||||||
#if defined (__HAIKU__) // Haiku needs it, at least for now
|
#if defined (__HAIKU__) || defined (WIN32) // Haiku and MINGW/MSYS need it, at least for now
|
||||||
#define fmemopen_alternative
|
#define fmemopen_alternative
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -12404,7 +12404,13 @@ static void cleanup(void)
|
||||||
TTF_Quit();
|
TTF_Quit();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
|
/* Call this once only, at exit */
|
||||||
|
#if !defined(NOSVG) && !defined(OLD_SVG)
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("rsvg_term()\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
|
rsvg_term();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16535,7 +16541,7 @@ static int charsize(Uint16 c)
|
||||||
str[0] = c;
|
str[0] = c;
|
||||||
str[1] = '\0';
|
str[1] = '\0';
|
||||||
|
|
||||||
TTF_SizeUNICODE(getfonthandle(cur_font), str, &w, &h);
|
TTF_SizeUNICODE(getfonthandle(cur_font)->ttf_font, str, &w, &h);
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
@ -17071,8 +17077,6 @@ static SDL_Surface * load_svg(char * file)
|
||||||
|
|
||||||
/* Create an RSVG Handle from the SVG file: */
|
/* Create an RSVG Handle from the SVG file: */
|
||||||
|
|
||||||
rsvg_init();
|
|
||||||
|
|
||||||
gerr = NULL;
|
gerr = NULL;
|
||||||
|
|
||||||
rsvg_handle = rsvg_handle_new_from_file(file, &gerr);
|
rsvg_handle = rsvg_handle_new_from_file(file, &gerr);
|
||||||
|
|
@ -17221,8 +17225,6 @@ static SDL_Surface * load_svg(char * file)
|
||||||
free(image);
|
free(image);
|
||||||
cairo_destroy(cr);
|
cairo_destroy(cr);
|
||||||
|
|
||||||
rsvg_term();
|
|
||||||
|
|
||||||
return(sdl_surface);
|
return(sdl_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22545,6 +22547,14 @@ static void setup(void)
|
||||||
|
|
||||||
signal(SIGPIPE, signal_handler);
|
signal(SIGPIPE, signal_handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Call this once */
|
||||||
|
#if !defined(NOSVG) && !defined(OLD_SVG)
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("rsvg_init()\n"); fflush(stdout);
|
||||||
|
#endif
|
||||||
|
rsvg_init();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -23591,10 +23601,6 @@ int button(int id, int x, int y)
|
||||||
if (texttool_len < (sizeof(texttool_str) / sizeof(wchar_t)) - 1)
|
if (texttool_len < (sizeof(texttool_str) / sizeof(wchar_t)) - 1)
|
||||||
{
|
{
|
||||||
int old_cursor_textwidth = cursor_textwidth;
|
int old_cursor_textwidth = cursor_textwidth;
|
||||||
#ifdef DEBUG
|
|
||||||
wprintf(L" key = <%c>\nunicode = <%lc> 0x%04x %d\n\n",
|
|
||||||
key_down, key_unicode, key_unicode, key_unicode);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
texttool_str[texttool_len++] = *im_cp;
|
texttool_str[texttool_len++] = *im_cp;
|
||||||
texttool_str[texttool_len] = 0;
|
texttool_str[texttool_len] = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue