fix crash in single-monitor execp
Chris Lee @klee93
2 files changed,
8 insertions(+),
2 deletions(-)
M
src/execplugin/execplugin.c
→
src/execplugin/execplugin.c
@@ -66,7 +66,8 @@ execp_backend->backend->command,
execp_backend->backend->monitor, panel->monitor); Execp *dummy = create_execp(); dummy->frontend = (ExecpFrontend *)calloc(1, sizeof(ExecpFrontend)); - dummy->backend->instances = g_list_append(execp_backend->backend->instances, dummy); + dummy->backend->instances = g_list_append(dummy->backend->instances, dummy); + dummy->dummy = true; return dummy; } printf("Creating executor '%s' with monitor %d for panel on monitor %d\n",@@ -89,7 +90,11 @@ execp->backend->instances = g_list_remove_all(execp->backend->instances, execp);
free_and_null(execp->frontend); remove_area(&execp->area); free_area(&execp->area); - free_and_null(execp); + if (execp->dummy) { + destroy_execp(execp); + } else { + free_and_null(execp); + } } else { // This is a backend element destroy_timer(&execp->backend->timer);
M
src/execplugin/execplugin.h
→
src/execplugin/execplugin.h
@@ -97,6 +97,7 @@ // All elements have the backend pointer set. However only backend elements have ownership.
ExecpBackend *backend; // Set only for frontend Execp items. ExecpFrontend *frontend; + bool dummy; } Execp; // Called before the config is read and panel_config/panels are created.