fix crash in single-monitor execp

This commit is contained in:
Chris Lee 2021-05-01 19:15:38 +02:00
parent 5e8c65b87e
commit 66a6238014
2 changed files with 8 additions and 2 deletions

View file

@ -66,7 +66,8 @@ gpointer create_execp_frontend(gconstpointer arg, gpointer data)
execp_backend->backend->monitor, panel->monitor); execp_backend->backend->monitor, panel->monitor);
Execp *dummy = create_execp(); Execp *dummy = create_execp();
dummy->frontend = (ExecpFrontend *)calloc(1, sizeof(ExecpFrontend)); 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; return dummy;
} }
printf("Creating executor '%s' with monitor %d for panel on monitor %d\n", printf("Creating executor '%s' with monitor %d for panel on monitor %d\n",
@ -89,7 +90,11 @@ void destroy_execp(void *obj)
free_and_null(execp->frontend); free_and_null(execp->frontend);
remove_area(&execp->area); remove_area(&execp->area);
free_area(&execp->area); free_area(&execp->area);
free_and_null(execp); if (execp->dummy) {
destroy_execp(execp);
} else {
free_and_null(execp);
}
} else { } else {
// This is a backend element // This is a backend element
destroy_timer(&execp->backend->timer); destroy_timer(&execp->backend->timer);

View file

@ -97,6 +97,7 @@ typedef struct Execp {
ExecpBackend *backend; ExecpBackend *backend;
// Set only for frontend Execp items. // Set only for frontend Execp items.
ExecpFrontend *frontend; ExecpFrontend *frontend;
bool dummy;
} Execp; } Execp;
// Called before the config is read and panel_config/panels are created. // Called before the config is read and panel_config/panels are created.