forked from external/yambar
bar: destroy modules in destroy(), not at the end of run()
This ensures we properly destroy everything when a bar has been instantiated, but not run().
This commit is contained in:
parent
87cf6ab10f
commit
cb0bc20b38
1 changed files with 27 additions and 26 deletions
53
bar/bar.c
53
bar/bar.c
|
@ -306,31 +306,6 @@ run(struct bar *_bar)
|
|||
|
||||
LOG_DBG("modules joined");
|
||||
|
||||
for (size_t i = 0; i < bar->left.count; i++) {
|
||||
struct module *m = bar->left.mods[i];
|
||||
struct exposable *e = bar->left.exps[i];
|
||||
|
||||
if (e != NULL)
|
||||
e->destroy(e);
|
||||
m->destroy(m);
|
||||
}
|
||||
for (size_t i = 0; i < bar->center.count; i++) {
|
||||
struct module *m = bar->center.mods[i];
|
||||
struct exposable *e = bar->center.exps[i];
|
||||
|
||||
if (e != NULL)
|
||||
e->destroy(e);
|
||||
m->destroy(m);
|
||||
}
|
||||
for (size_t i = 0; i < bar->right.count; i++) {
|
||||
struct module *m = bar->right.mods[i];
|
||||
struct exposable *e = bar->right.exps[i];
|
||||
|
||||
if (e != NULL)
|
||||
e->destroy(e);
|
||||
m->destroy(m);
|
||||
}
|
||||
|
||||
bar->backend.iface->cleanup(_bar);
|
||||
|
||||
if (bar->cairo)
|
||||
|
@ -340,7 +315,6 @@ run(struct bar *_bar)
|
|||
cairo_surface_finish(bar->cairo_surface);
|
||||
cairo_surface_destroy(bar->cairo_surface);
|
||||
}
|
||||
cairo_debug_reset_static_data();
|
||||
|
||||
LOG_DBG("bar exiting");
|
||||
return ret;
|
||||
|
@ -351,6 +325,33 @@ destroy(struct bar *bar)
|
|||
{
|
||||
struct private *b = bar->private;
|
||||
|
||||
for (size_t i = 0; i < b->left.count; i++) {
|
||||
struct module *m = b->left.mods[i];
|
||||
struct exposable *e = b->left.exps[i];
|
||||
|
||||
if (e != NULL)
|
||||
e->destroy(e);
|
||||
m->destroy(m);
|
||||
}
|
||||
for (size_t i = 0; i < b->center.count; i++) {
|
||||
struct module *m = b->center.mods[i];
|
||||
struct exposable *e = b->center.exps[i];
|
||||
|
||||
if (e != NULL)
|
||||
e->destroy(e);
|
||||
m->destroy(m);
|
||||
}
|
||||
for (size_t i = 0; i < b->right.count; i++) {
|
||||
struct module *m = b->right.mods[i];
|
||||
struct exposable *e = b->right.exps[i];
|
||||
|
||||
if (e != NULL)
|
||||
e->destroy(e);
|
||||
m->destroy(m);
|
||||
}
|
||||
|
||||
cairo_debug_reset_static_data();
|
||||
|
||||
free(b->left.mods);
|
||||
free(b->left.exps);
|
||||
free(b->center.mods);
|
||||
|
|
Loading…
Add table
Reference in a new issue