https://bugs.kde.org/show_bug.cgi?id=409667

            Bug ID: 409667
           Summary: kdenlive crashes on startup with ASSERT failure in
                    QCoreApplication::sendEvent: "Cannot send events to
                    objects owned by a different thread"
           Product: kdenlive
           Version: 19.04.2
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Installation
          Assignee: vpi...@kde.org
          Reporter: fa...@kde.org
  Target Milestone: ---

SUMMARY
I build kdenlive from git branch Applications/19.04 (build type
RelWithDebInfo), on top of a self-compiled Qt 5.13 from git, in debug mode.

kdenlive asserts on startup, because setProperty() is called on GLWidget (a
QQuickView) from the QtQuick render thread.

setProperty calls sendEvent (with a QDynamicPropertyChangeEvent), which leads
to the assert.

(gdb) bt
#0  0x00007fffed807160 in raise () at /lib64/libc.so.6
#1  0x00007fffed808741 in abort () at /lib64/libc.so.6
#2  0x00007fffee722044 in qt_message_fatal(QtMsgType, QMessageLogContext
const&, QString const&) (context=..., message="ASSERT failure in
QCoreApplication::sendEvent: \"Cannot send events to objects owned by a
different thread. Current thread 0x0x5446c90. Receiver '' (of type 'GLWidget')
was created in thread 0x0xe57a80\", file
/d/qt/5/kde/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 578") at
/d/qt/5/kde/qtbase/src/corelib/global/qlogging.cpp:1904
#3  0x00007fffee722b30 in QMessageLogger::fatal(char const*, ...) const
(this=this@entry=0x7fff8dc033b0, msg=msg@entry=0x7fffee9d9858 "ASSERT failure
in %s: \"%s\", file %s, line %d") at
/d/qt/5/kde/qtbase/src/corelib/global/qlogging.cpp:888
#4  0x00007fffee71cb69 in qt_assert_x(char const*, char const*, char const*,
int) (where=where@entry=0x7fffeeab30cb "QCoreApplication::sendEvent",
what=<optimized out>, file=file@entry=0x7fffeeab2968
"/d/qt/5/kde/qtbase/src/corelib/kernel/qcoreapplication.cpp",
line=line@entry=578) at /d/qt/5/kde/qtbase/src/corelib/global/qglobal.cpp:3262
#5  0x00007fffee8f4d9d in
QCoreApplicationPrivate::checkReceiverThread(QObject*)
(receiver=receiver@entry=0x25ecff0) at
/d/qt/5/kde/qtbase/src/corelib/kernel/qcoreapplication.cpp:572
#6  0x00007ffff04a0c0a in QApplication::notify(QObject*, QEvent*)
(this=0x7fffffffcce0, receiver=0x25ecff0, e=0x7fff8dc036b0) at
/d/qt/5/kde/qtbase/src/widgets/kernel/qapplication.cpp:2942
#7  0x00007fffee8f5378 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
(receiver=0x25ecff0, event=0x7fff8dc036b0) at
/d/qt/5/kde/qtbase/src/corelib/kernel/qcoreapplication.cpp:1086
#8  0x00007fffee8f55a0 in QCoreApplication::sendEvent(QObject*, QEvent*)
(receiver=<optimized out>, event=<optimized out>) at
/d/qt/5/kde/qtbase/src/corelib/kernel/qcoreapplication.cpp:1481
#9  0x00007fffee92e13b in QObject::setProperty(char const*, QVariant const&)
(this=this@entry=0x25ecff0, name=name@entry=0xade4de "mlt_service", value=...)
at /d/qt/5/kde/qtbase/src/corelib/kernel/qobject.cpp:3946
#10 0x0000000000785058 in GLWidget::reconfigure(bool)
(this=this@entry=0x25ecff0, reload=reload@entry=false) at
/d/kde/src/5/kde/kdemultimedia/kdenlive/src/monitor/glwidget.cpp:1222
#11 0x0000000000785c9c in GLWidget::initializeGL() (this=0x25ecff0) at
/d/kde/src/5/kde/kdemultimedia/kdenlive/src/monitor/glwidget.cpp:227
#12 0x00007fffee926fd3 in QtPrivate::QSlotObjectBase::call(QObject*, void**)
(a=0x7fff8dc039c8, r=0x25ecff0, this=<optimized out>) at
../../include/QtCore/../../../../qtbase/src/corelib/kernel/qobjectdefs_impl.h:394
#13 0x00007fffee926fd3 in QMetaObject::activate(QObject*, int, int, void**)
(sender=sender@entry=0x25ecff0, signalOffset=<optimized out>,
local_signal_index=local_signal_index@entry=2, argv=0x7fff8dc039c8,
argv@entry=0x0) at /d/qt/5/kde/qtbase/src/corelib/kernel/qobject.cpp:3787
#14 0x00007fffee927429 in QMetaObject::activate(QObject*, QMetaObject const*,
int, void**) (sender=0x25ecff0, m=m@entry=0x7ffff2cc3b00
<QQuickWindow::staticMetaObject>,
local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x0) at
/d/qt/5/kde/qtbase/src/corelib/kernel/qobject.cpp:3658
#15 0x00007ffff2806098 in QQuickWindow::sceneGraphInitialized()
(this=<optimized out>) at .moc/moc_qquickwindow.cpp:503
#16 0x00007ffff280a466 in QQuickWindow::qt_static_metacall(QObject*,
QMetaObject::Call, int, void**) (_o=_o@entry=0x25ecff0,
_c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=2,
_a=_a@entry=0x7fff8dc03b18) at .moc/moc_qquickwindow.cpp:263
#17 0x00007fffee92715d in QMetaObject::activate(QObject*, int, int, void**)
(sender=sender@entry=0x263fae0, signalOffset=<optimized out>,
local_signal_index=local_signal_index@entry=0, argv=0x7fff8dc03b18,
argv@entry=0x0) at /d/qt/5/kde/qtbase/src/corelib/kernel/qobject.cpp:3807
#18 0x00007fffee927429 in QMetaObject::activate(QObject*, QMetaObject const*,
int, void**) (sender=sender@entry=0x263fae0, m=m@entry=0x7ffff2cbebc0
<QSGRenderContext::staticMetaObject>,
local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at
/d/qt/5/kde/qtbase/src/corelib/kernel/qobject.cpp:3658
#19 0x00007ffff277d26e in QSGRenderContext::initialized()
(this=this@entry=0x263fae0) at .moc/moc_qsgcontext_p.cpp:221
#20 0x00007ffff279f232 in QSGDefaultRenderContext::initialize(void*)
(this=0x263fae0, context=<optimized out>) at
/d/qt/5/kde/qtdeclarative/src/quick/scenegraph/qsgdefaultrendercontext.cpp:112
#21 0x00007ffff27aeee4 in QSGRenderThread::run() (this=0x5446c90) at
/d/qt/5/kde/qtdeclarative/src/quick/scenegraph/qsgthreadedrenderloop.cpp:729
#22 0x00007fffee72d010 in QThreadPrivate::start(void*) (arg=0x5446c90) at
/d/qt/5/kde/qtbase/src/corelib/thread/qthread_unix.cpp:364
#23 0x00007fffea99d569 in start_thread () at /lib64/libpthread.so.0
#24 0x00007fffed8c99ef in clone () at /lib64/libc.so.6

(gdb) fr 10
#10 0x0000000000785058 in GLWidget::reconfigure (this=this@entry=0x25ecff0,
reload=reload@entry=false) at
/d/kde/src/5/kde/kdemultimedia/kdenlive/src/monitor/glwidget.cpp:1222
1222                    setProperty("mlt_service", serviceName);
(gdb) p thread()
[Thread 0x7fffb5625700 (LWP 17890) exited]
$1 = (QAdoptedThread *) 0xe57a80

I'm guessing the GLWidget was created in this thread:
(gdb) thr 13
[Switching to thread 13 (Thread 0x7fff8f9c5700 (LWP 17898))]
#0  0x00007fffed8c4269 in syscall () from /lib64/libc.so.6
(gdb) bt
#0  0x00007fffed8c4269 in syscall () at /lib64/libc.so.6
#1  0x00007fffee72f705 in QtLinuxFutex::_q_futex(int*, int, int, unsigned long
long, int*, int) (val3=0, addr2=0x0, val2=0, val=0, op=0, addr=<optimized out>)
at /d/qt/5/kde/qtbase/src/corelib/thread/qfutex_p.h:92
#2  0x00007fffee72f705 in QtLinuxFutex::futexWait<QBasicAtomicInteger<unsigned
int> >(QBasicAtomicInteger<unsigned int>&, QBasicAtomicInteger<unsigned
int>::Type) (expectedValue=0, futex=...) at
/d/qt/5/kde/qtbase/src/corelib/thread/qfutex_p.h:107
#3  0x00007fffee72f705 in
futexSemaphoreTryAcquire_loop<false>(QBasicAtomicInteger<unsigned long long>&,
unsigned long long, unsigned long long, int) (u=...,
curValue=curValue@entry=4294967296, nn=nn@entry=8589934593,
timeout=timeout@entry=-1) at
/d/qt/5/kde/qtbase/src/corelib/thread/qsemaphore.cpp:219
#4  0x00007fffee72f828 in
futexSemaphoreTryAcquire<false>(QBasicAtomicInteger<unsigned long long>&, int,
int) (u=..., n=n@entry=1, timeout=timeout@entry=-1) at
/d/qt/5/kde/qtbase/src/corelib/thread/qsemaphore.cpp:262
#5  0x00007fffee72f5e8 in QSemaphore::acquire(int) (this=this@entry=0x2b0f388,
n=n@entry=1) at /d/qt/5/kde/qtbase/src/corelib/thread/qsemaphore.cpp:326
#6  0x000000000078213e in GLWidget::createThread(RenderThread**, void*
(*)(void*), void*) (this=0x2b0f2d0, thread=0x64ebe70, function=0x7ffff1e6a410,
data=0x6526090) at
/d/kde/src/5/kde/kdemultimedia/kdenlive/src/monitor/glwidget.cpp:850
#7  0x0000000000782195 in onThreadCreate(mlt_properties, GLWidget*,
RenderThread**, int*, thread_function_t, void*) (owner=<optimized out>,
self=0x2b0f2d0, thread=<optimized out>, priority=<optimized out>,
function=<optimized out>, data=<optimized out>) at
/d/kde/src/5/kde/kdemultimedia/kdenlive/src/monitor/glwidget.cpp:862
#8  0x00007ffff1e61b9e in mlt_events_fire () at /usr/lib64/libmlt.so.6
#9  0x00007ffff1e6b8e7 in mlt_consumer_rt_frame () at /usr/lib64/libmlt.so.6
#10 0x00007fffbd0e0e30 in  () at /usr/lib64/mlt-6/libmltsdl2.so
#11 0x00007fffea99d569 in start_thread () at /lib64/libpthread.so.0
#12 0x00007fffed8c99ef in clone () at /lib64/libc.so.6

I guess the fix is to use a queued invokeMethod for this setProperty call?
Assuming of course that it can wait until the owner thread processes it...

STEPS TO REPRODUCE
1. kdenlive

Linux: openSUSE Leap 15.1 (but Qt/KF5/kdenlive compiled by me)
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.60.0
Qt Version: 5.13.0

ADDITIONAL INFORMATION
I can test a fix if you provide one.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to