Skip to content

Commit

Permalink
widget: call cleanwidget() only after widget_set()
Browse files Browse the repository at this point in the history
Also remove double error messages.
  • Loading branch information
phillbush committed Jun 8, 2023
1 parent 6f28d98 commit d4bf3c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion widget.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ struct Selection {
};

struct Widget {
int start;
bool start, isset;
int redraw;

/* X11 stuff */
Expand Down Expand Up @@ -1476,6 +1476,8 @@ cleanwidget(Widget *widget)
struct Selection *sel;
void *tmp;

if (!widget->isset)
return;
thumb = widget->thumbhead;
while (thumb != NULL) {
tmp = thumb;
Expand Down Expand Up @@ -3280,6 +3282,7 @@ widget_set(Widget *widget, const char *title, char **items[], size_t nitems, Scr
{
size_t i;

widget->isset = true;
XUndefineCursor(widget->display, widget->window);
cleanwidget(widget);
widget->items = items;
Expand Down
2 changes: 1 addition & 1 deletion xfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ main(int argc, char *argv[])
path = *argv;
initthumbnailer(&fm);
if ((fm.widget = widget_create(APPCLASS, name, saveargc, saveargv, resources)) == NULL)
errx(EXIT_FAILURE, "could not initialize X widget");
exit(EXIT_FAILURE);
#if __OpenBSD__
if (pledge("stdio rpath proc exec", NULL) == RETURN_FAILURE)
err(EXIT_FAILURE, "pledge");
Expand Down

0 comments on commit d4bf3c1

Please sign in to comment.