qt: segv in MediaSourceCache get getting pre-existing media source
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=139862546421312) at ./nptl/pthread_kill.c:44
44 ./nptl/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7f3449659640 (LWP 347875))]
(gdb) bt
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=139862546421312) at ./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=139862546421312) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=139862546421312, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3 0x00007f34ec1ab476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007f34ec1917f3 in __GI_abort () at ./stdlib/abort.c:79
#5 0x00007f34ec19171b in __assert_fail_base
(fmt=0x7f34ec346130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7f34ec58b4ef "prev", file=0x7f34ec58b4d4 "../../include/vlc_atomic.h", line=62, function=<optimized out>)
at ./assert/assert.c:92
#6 0x00007f34ec1a2e96 in __GI___assert_fail
(assertion=0x7f34ec58b4ef "prev", file=0x7f34ec58b4d4 "../../include/vlc_atomic.h", line=62, function=0x7f34ec58b600 <__PRETTY_FUNCTION__.3> "vlc_atomic_rc_inc") at ./assert/assert.c:101
#7 0x00007f34ec5d91aa in vlc_atomic_rc_inc (rc=0x7f3428024be8) at ../../include/vlc_atomic.h:62
#8 0x00007f34ec5d96b7 in vlc_media_source_Hold (ms=0x7f3428024bd0) at ../../src/media_source/media_source.c:173
#9 0x00007f34ec5d99ba in vlc_media_source_provider_GetMediaSource (provider=0x55e72e2dc7e0, name=0x7f342803d0c0 "pulse") at ../../src/media_source/media_source.c:265
#10 0x00007f34e5cb2417 in MediaSourceCache::getMediaSourceModel(vlc_media_source_provider_t*, char const*) (this=0x7f342801f620, provider=0x55e72e2dc7e0, name=0x7f342803d0c0 "pulse")
at ../../../../modules/gui/qt/network/devicesourceprovider.cpp:197
#11 0x00007f34e5cb2962 in operator()(Ctx&) const (__closure=0x7f34c84bce10, ctx=...) at ../../../../modules/gui/qt/network/devicesourceprovider.cpp:259
#12 0x00007f34e5cb3beb in std::__invoke_impl<void, DeviceSourceProvider::init()::<lambda(DeviceSourceProvider::init()::Ctx&)>&, DeviceSourceProvider::init()::Ctx&>(std::__invoke_other, struct {...} &) (__f=...) at /usr/include/c++/11/bits/invoke.h:61
#13 0x00007f34e5cb38ff in std::__invoke_r<void, DeviceSourceProvider::init()::<lambda(DeviceSourceProvider::init()::Ctx&)>&, DeviceSourceProvider::init()::Ctx&>(struct {...} &) (__fn=...)
at /usr/include/c++/11/bits/invoke.h:111
#14 0x00007f34e5cb3321 in std::_Function_handler<void(DeviceSourceProvider::init()::Ctx&), DeviceSourceProvider::init()::<lambda(DeviceSourceProvider::init()::Ctx&)> >::_M_invoke(const std::_Any_data &, Ctx &) (__functor=..., __args#0=...) at /usr/include/c++/11/bits/std_function.h:290
#15 0x00007f34e5cb412b in std::function<void(DeviceSourceProvider::init()::Ctx&)>::operator()(Ctx &) const (this=0x7f34c91d7bf8, __args#0=...) at /usr/include/c++/11/bits/std_function.h:590
#16 0x00007f34e5cb4041 in RunOnThreadRunner<DeviceSourceProvider::init()::Ctx>::run(void) (this=0x7f34c91d7b90) at ../../../../modules/gui/qt/medialibrary/mlthreadpool.hpp:156
#17 0x00007f34d2f3c38c in QThreadPoolThread::run() (this=0x7f34c84a3190) at /home/pierre/workspace/3rdparty/qt5/qtbase/src/corelib/thread/qthreadpool.cpp:100
#18 0x00007f34d2f35f57 in operator() (__closure=<optimized out>, __closure=<optimized out>) at /home/pierre/workspace/3rdparty/qt5/qtbase/src/corelib/thread/qthread_unix.cpp:355
#19 (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=<optimized out>, t=<optimized out>)
at /home/pierre/workspace/3rdparty/qt5/qtbase/src/corelib/thread/qthread_unix.cpp:291
#20 QThreadPrivate::start(void*) (arg=0x7f34c84a3190) at /home/pierre/workspace/3rdparty/qt5/qtbase/src/corelib/thread/qthread_unix.cpp:314
#21 0x00007f34ec1fdac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#22 0x00007f34ec28f850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
looks like we unreferenced the mediasource without taking a reference on it