bar: call backend->cleanup() when backend->setup() fails

This makes it easier to implement proper cleanup in the backends, as
setup() doesn't have to clean up it's own mess upon failure.
This commit is contained in:
Daniel Eklöf 2019-02-07 11:50:52 +01:00
parent 0fc5778107
commit f71aaf9615

View file

@ -245,8 +245,10 @@ run(struct bar *_bar)
bar->height_with_border = bar->height + 2 * bar->border.width; bar->height_with_border = bar->height + 2 * bar->border.width;
if (!bar->backend.iface->setup(_bar)) if (!bar->backend.iface->setup(_bar)) {
bar->backend.iface->cleanup(_bar);
return 1; return 1;
}
set_cursor(_bar, "left_ptr"); set_cursor(_bar, "left_ptr");