Potential deadlock when replacing external libvlc instance
https://code.videolan.org/videolan/medialibrary/-/jobs/848415
Thread 8 (Thread 0x7fcc915d6700 (LWP 110916) "samples"):
#0 0x00007fcc98791e2b in __lll_lock_wait () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007fcc9878a843 in pthread_mutex_lock () from /lib/x86_64-linux-gnu/libpthread.so.0
#2 0x000055f67b2d51fb in __gthread_mutex_lock (__mutex=0x616000000088) at /usr/include/x86_64-linux-gnu/c++/10/bits/gthr-default.h:749
#3 0x000055f67b2d566d in std::mutex::lock (this=0x616000000088) at /usr/include/c++/10/bits/std_mutex.h:100
#4 0x000055f67b2fa026 in std::unique_lock<std::mutex>::lock (this=0x7fcc915d4680) at /usr/include/c++/10/bits/unique_lock.h:138
#5 0x000055f67b2e4113 in std::unique_lock<std::mutex>::unique_lock (this=0x7fcc915d4680, __m=...) at /usr/include/c++/10/bits/unique_lock.h:68
#6 0x00007fcc9b17fe1e in medialibrary::MediaLibrary::getParser (this=0x616000000080) at ../src/MediaLibrary.cpp:2173
#7 0x00007fcc9b10b9a9 in medialibrary::MediaLibrary::onDiscoveredFile (this=0x616000000080, fileFs=std::shared_ptr<medialibrary::fs::IFile> (use count 2, weak count 0) = {...}, parentFolder=std::shared_ptr<medialibrary::Folder> (use count 3, weak count 0) = {...}, parentFolderFs=std::shared_ptr<medialibrary::fs::IDirectory> (use count 3, weak count 0) = {...}, fileType=medialibrary::IFile::Type::Playlist) at ../src/MediaLibrary.cpp:808
#8 0x00007fcc9b3c846e in medialibrary::FsDiscoverer::checkFiles (this=0x60c00003a180, parentFolderFs=std::shared_ptr<medialibrary::fs::IDirectory> (use count 3, weak count 0) = {...}, parentFolder=std::shared_ptr<medialibrary::Folder> (use count 3, weak count 0) = {...}) at ../src/discoverer/FsDiscoverer.cpp:547
#9 0x00007fcc9b3c16d4 in medialibrary::FsDiscoverer::checkFolder (this=0x60c00003a180, folderFs=std::shared_ptr<medialibrary::fs::IDirectory> (empty) = {...}, folder=std::shared_ptr<medialibrary::Folder> (empty) = {...}, fsFactory=...) at ../src/discoverer/FsDiscoverer.cpp:425
#10 0x00007fcc9b3b8d47 in medialibrary::FsDiscoverer::reloadFolder (this=0x60c00003a180, f=std::shared_ptr<medialibrary::Folder> (empty) = {...}, fsFactory=...) at ../src/discoverer/FsDiscoverer.cpp:90
#11 0x00007fcc9b3bcd44 in medialibrary::FsDiscoverer::reload (this=0x60c00003a180, entryPoint="file:///builds/videolan/medialibrary/test/samples/samples/playlist/external_folder/") at ../src/discoverer/FsDiscoverer.cpp:244
#12 0x00007fcc9b3895bd in medialibrary::DiscovererWorker::runReload (this=0x60f000012e20, entryPoint="file:///builds/videolan/medialibrary/test/samples/samples/playlist/external_folder/") at ../src/discoverer/DiscovererWorker.cpp:507
#13 0x00007fcc9b3880eb in medialibrary::DiscovererWorker::run (this=0x60f000012e20) at ../src/discoverer/DiscovererWorker.cpp:454
Thread 1 (Thread 0x7fcc9655a100 (LWP 110634) "samples"):
#0 0x00007fcc987894a7 in __pthread_clockjoin_ex () from /lib/x86_64-linux-gnu/libpthread.so.0
#1 0x00007fcc985680e3 in std::thread::join() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2 0x00007fcc9b37f25e in medialibrary::DiscovererWorker::stop (this=0x60f000012e20) at ../src/discoverer/DiscovererWorker.cpp:88
#3 0x00007fcc9b185017 in medialibrary::MediaLibrary::setExternalLibvlcInstance (this=0x616000000080, inst=0x6080000ccfa0) at ../src/MediaLibrary.cpp:2445
#4 0x000055f67b275abc in ReplaceVlcInstance (T=0x60f000000040) at ../test/samples/main.cpp:115
#5 0x000055f67b280c8d in main (ac=3, av=0x7ffd724f9a78) at ../test/samples/main.cpp:240