Commit 29d2f61e authored by spiiroin's avatar spiiroin

[worker] Use copy of target mode during transition. JB#43781

The common_map_mode_to_hardware() function can return the same
string that it was given as an argument. In the context of
worker_execute() function this can lead to using string pointer
that can get invalidated after releasing mutex.

Allocate copy of target mode before releasing mutex and use it
in the subsequent operations.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent ccd8d21d
......@@ -468,14 +468,17 @@ worker_execute(void)
log_debug("activate = %s", activate);
bool changed = g_strcmp0(activated, activate) != 0;
gchar *mode = g_strdup(activate);
WORKER_LOCKED_LEAVE;
if( changed )
worker_switch_to_mode(activate);
worker_switch_to_mode(mode);
else
worker_notify();
g_free(mode);
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment