Page MenuHomePhabricator

sysinfo gadgets misuse ecore_thread api
Closed, ResolvedPublic

Description

Threads do not immediately end, so the thread lifetime must be taken into account independently of the gadget lifetime or else this sort of thing will happen:

Thread 1 "enlightenment" received signal SIGSEGV, Segmentation fault.
0x00007fffdfa76613 in _cpumonitor_cb_usage_check_notify (data=0x189e7b0, th=0xb53470, msg=0x0)
    at src/modules/sysinfo/cpumonitor/cpumonitor.c:186
186	   if (inst->cfg->esm != E_SYSINFO_MODULE_CPUMONITOR && inst->cfg->esm != E_SYSINFO_MODULE_SYSINFO) return;
(gdb) p inst->cfg
$5 = (Config_Item *) 0x20
(gdb) p *inst
$6 = {o_main = 0x80000075f759dda6, o_table = 0x21, popup_battery = 0x189e7a0, warning = 0xf070f0, 
  cfg = 0x20, notification_id = 64}
(gdb) bt
#0  0x00007fffdfa76613 in _cpumonitor_cb_usage_check_notify (data=0x189e7b0, th=0xb53470, msg=0x0)
    at src/modules/sysinfo/cpumonitor/cpumonitor.c:186
#1  0x00007ffff03bee3e in _ecore_notify_handler (data=0x7fffbc0008c0)
    at lib/ecore/ecore_thread.c:276
#2  0x00007ffff0391d0d in _ecore_main_call_flush () at lib/ecore/ecore.c:1033
#3  0x00007ffff0391d95 in _thread_callback (data=0x0, buffer=0x15d5610, nbyte=4)
    at lib/ecore/ecore.c:1044
#4  0x00007ffff03bb4a2 in _ecore_pipe_handler_call (p=0x85e2e0, buf=0x15d5610 "*", len=4)
    at lib/ecore/ecore_pipe.c:646
#5  0x00007ffff03bb7d8 in _ecore_pipe_read (data=0x85e2e0, fd_handler=0x853fb0)
    at lib/ecore/ecore_pipe.c:772
#6  0x00007ffff039beeb in _ecore_call_fd_cb (func=0x7ffff03bb4b1 <_ecore_pipe_read>, 
    data=0x85e2e0, fd_handler=0x853fb0) at lib/ecore/ecore_private.h:341
#7  0x00007ffff039e7bc in _ecore_main_fd_handlers_call () at lib/ecore/ecore_main.c:2005
#8  0x00007ffff039f18e in _ecore_main_loop_iterate_internal (once_only=0)
    at lib/ecore/ecore_main.c:2392
#9  0x00007ffff039cccf in ecore_main_loop_begin () at lib/ecore/ecore_main.c:1299
#10 0x000000000043e302 in main (argc=2, argv=0x7fffffffdd38) at src/bin/e_main.c:1081

The gadget has been deleted, but the thread has not yet terminated.