Fix regression caused by imlib leak (related: issue #704)
This commit is contained in:
parent
94d4a219ee
commit
21e9303502
1 changed files with 5 additions and 1 deletions
|
@ -788,11 +788,15 @@ void draw_text(PangoLayout *layout, cairo_t *c, int posx, int posy, Color *color
|
||||||
Imlib_Image load_image(const char *path, int cached)
|
Imlib_Image load_image(const char *path, int cached)
|
||||||
{
|
{
|
||||||
Imlib_Image image;
|
Imlib_Image image;
|
||||||
|
static unsigned long counter = 0;
|
||||||
|
if (debug_icons)
|
||||||
|
fprintf(stderr, "tint2: loading icon %s\n", path);
|
||||||
#ifdef HAVE_RSVG
|
#ifdef HAVE_RSVG
|
||||||
image = imlib_load_image(path);
|
image = imlib_load_image(path);
|
||||||
if (!image && g_str_has_suffix(path, ".svg")) {
|
if (!image && g_str_has_suffix(path, ".svg")) {
|
||||||
char tmp_filename[128];
|
char tmp_filename[128];
|
||||||
snprintf(tmp_filename, sizeof(tmp_filename), "/tmp/tint2-%d.png", (int)getpid());
|
snprintf(tmp_filename, sizeof(tmp_filename), "/tmp/tint2-%d-%lu.png", (int)getpid(), counter);
|
||||||
|
counter++;
|
||||||
int fd = open(tmp_filename, O_CREAT | O_EXCL, 0600);
|
int fd = open(tmp_filename, O_CREAT | O_EXCL, 0600);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
// We fork here because librsvg allocates memory like crazy
|
// We fork here because librsvg allocates memory like crazy
|
||||||
|
|
Loading…
Reference in a new issue