Browse Source

free stuff earlier, when they're no longer used

master
phillbush 4 years ago
parent
commit
d3c2131250
1 changed files with 7 additions and 9 deletions
  1. +7
    -9
      xmenu.c

+ 7
- 9
xmenu.c View File

@@ -1015,16 +1015,21 @@ drawitems(struct Menu *menu)
Convex, CoordModeOrigin);
}

/* draw icon */
if (item->file && !iflag)
/* try to load icon */
if (item->file && !iflag) {
item->icon = loadicon(item->file);
free(item->file);
}

/* draw icon if properly loaded */
if (item->icon) {
imlib_context_set_image(item->icon);
imlib_context_set_drawable(item->sel);
imlib_render_image_on_drawable(config.horzpadding, config.iconpadding);
imlib_context_set_drawable(item->unsel);
imlib_render_image_on_drawable(config.horzpadding, config.iconpadding);
imlib_context_set_image(item->icon);
imlib_free_image();
}
}
}
@@ -1316,13 +1321,6 @@ cleanmenu(struct Menu *menu)
if (tmp->label != tmp->output)
free(tmp->label);
free(tmp->output);
if (tmp->file != NULL) {
free(tmp->file);
if (tmp->icon != NULL) {
imlib_context_set_image(tmp->icon);
imlib_free_image();
}
}
item = item->next;
free(tmp);
}


Loading…
Cancel
Save