mirror of https://github.com/labapart/gattlib
mainloop/gattlib_glib_mainloop: Fix non initialized variable
parent
aaab2dc74e
commit
f4ed88eb31
|
@ -34,14 +34,18 @@ int gattlib_mainloop(void* (*task)(void* arg), void *arg) {
|
|||
GError* error;
|
||||
|
||||
if (m_main_loop != NULL) {
|
||||
GATTLIB_LOG(GATTLIB_ERROR, "Main loop is already running: %s", error->message);
|
||||
g_error_free(error);
|
||||
GATTLIB_LOG(GATTLIB_ERROR, "Main loop is already running");
|
||||
return GATTLIB_BUSY;
|
||||
}
|
||||
|
||||
m_main_loop = g_main_loop_new(NULL, FALSE);
|
||||
|
||||
GThread *task_thread = g_thread_try_new("gattlib_task", _execute_task, &execute_task_arg, &error);
|
||||
if (task_thread == NULL) {
|
||||
GATTLIB_LOG(GATTLIB_ERROR, "Could not create task for main loop: %s", error->message);
|
||||
g_error_free(error);
|
||||
return GATTLIB_UNEXPECTED;
|
||||
}
|
||||
|
||||
g_main_loop_run(m_main_loop);
|
||||
g_main_loop_unref(m_main_loop);
|
||||
|
|
Loading…
Reference in New Issue