Hi,
I call in my plugin in a loop (in a thread) cCutter::Active() every second. If I stop an editing process over the main menu entry, VDR crashes from time to time:
----------------------------------------------------------------------------- *** glibc detected *** vdr: double free or corruption (!prev): 0x08407fc0 *** ======= Backtrace: ========= /lib/tls/i686/cmov/libc.so.6[0xb7cff7cd] /lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7d02e30] vdr(_ZN14cCuttingThreadD0Ev+0x31)[0x809b7a1] vdr(_ZN7cCutter4StopEv+0x39)[0x809aa89] vdr(_ZN7cCutter6ActiveEv+0x3c)[0x809ab7c] /home/nordlicht/src/vdr-1.4.7/PLUGINS/lib/libvdr-extrecmenu.so.1.4.5(_ZN12WorkerThread6ActionEv+0x2e)[0xb73dadbe] vdr(_ZN7cThread11StartThreadEPS_+0x2c)[0x80fce1c] /lib/tls/i686/cmov/libpthread.so.0[0xb7f0431b] /lib/tls/i686/cmov/libc.so.6(clone+0x5e)[0xb7d6757e] -----------------------------------------------------------------------------
If I remove the cCutter::Active()-call from my thread, everything is fine.
Has anyone an idea what goes wrong there?
Greets, Martin
Martin Prochnow wrote:
cCutter::Active is more than a simple query function. It also does the cleanup of the thread, the error handling and the external script calls. Because of that, the function is not thread safe, and can only be called from the main thread. The double free is probably because both threads try to free cCutter::editedVersionName at the same time.
Cheers,
Udo