loop: Fix loop_get search priority

According to comments by @k-s & @raster.

See 784a5b56a3 this was intended to be a fallback, not the first
lookup indeed. Since this is an error case, let's print an ERR message
at least.
This commit is contained in:
Jean-Philippe Andre 2017-12-20 11:02:59 +09:00
parent 28661cb650
commit 0d85525dc8
1 changed files with 8 additions and 3 deletions

View File

@ -14,9 +14,14 @@ struct _Efl_Loop_Consumer_Data
static Efl_Loop *
_efl_loop_consumer_loop_get(Eo *obj, Efl_Loop_Consumer_Data *pd EINA_UNUSED)
{
if (eina_main_loop_is())
return ecore_main_loop_get();
return efl_provider_find(obj, EFL_LOOP_CLASS);
Efl_Loop *loop = efl_provider_find(obj, EFL_LOOP_CLASS);
if (!loop && eina_main_loop_is())
{
loop = ecore_main_loop_get();
ERR("Failed to get the loop on object %p from the main thread! "
"Returning the main loop: %p", obj, loop);
}
return loop;
}
static void