Commit de044e25 authored by spiiroin's avatar spiiroin

[usb_moded] Make sure charging timeout timer ids are not leaked

If charging_timeout should already contain a valid timer id when the
timer is started, the old timer will be leaked.

Remove existing timer id before assigning new one.
Signed-off-by: spiiroin's avatarSimo Piiroinen <simo.piiroinen@jollamobile.com>
parent 6ec3a730
......@@ -294,6 +294,8 @@ void set_usb_connected_state(void)
*/
usb_moded_send_signal(USB_CONNECTED_DIALOG_SHOW);
/* fallback to charging mode after 3 seconds */
if( charging_timeout )
g_source_remove(charging_timeout);
charging_timeout = g_timeout_add_seconds(3, charging_fallback, NULL);
/* in case there was nobody listening for the UI, they will know
that the UI is needed by requesting the current mode */
......
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