Skip to content

Commit f66647c

Browse files
committed
module: zero priv_data instead of cls
to allow multiple calls of module_done to same state (as keyboard_control is called). otherwise dump-tree would fail This acutally revers the commit 33bdcb4 (2020-03-13).
1 parent ee993d3 commit f66647c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/module.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,10 @@ void module_done(struct module *module_data)
102102
if(!module_data)
103103
return;
104104

105-
if (module_data->cls == MODULE_CLASS_NONE)
105+
if (module_data->module_priv == NULL) {
106106
return;
107-
107+
}
108+
108109
struct module_priv_state *module_priv = module_data->module_priv;
109110

110111
assert(module_priv->magic == MODULE_MAGIC);
@@ -117,8 +118,6 @@ void module_done(struct module *module_data)
117118
module_mutex_unlock(&module_priv->parent->lock);
118119
}
119120

120-
module_data->cls = MODULE_CLASS_NONE;
121-
122121
if(simple_linked_list_size(module_priv->children) > 0) {
123122
log_msg(LOG_LEVEL_WARNING, "Warning: Child database not empty! Remaining:\n");
124123
dump_tree(module_data, 0);
@@ -154,6 +153,7 @@ void module_done(struct module *module_data)
154153
simple_linked_list_destroy(module_priv->msg_queue_children);
155154

156155
pthread_mutex_destroy(&module_priv->lock);
156+
module_data->module_priv = NULL; // to multiple deinit
157157
free(module_priv);
158158
}
159159

0 commit comments

Comments
 (0)