Opened 12 years ago
Closed 12 years ago
Last modified 9 years ago
#10740 closed Patch - Bug Fix (Fixed)
[PATCH] libmythui: Fix an assert failure in Qt when playing a video
Reported by: | Owned by: | Jim Stichnoth | |
---|---|---|---|
Priority: | minor | Milestone: | 0.25.1 |
Component: | MythTV - Video Playback | Version: | 0.25-fixes |
Severity: | medium | Keywords: | DVD assert |
Cc: | Ticket locked: | no |
Description
Trying to play a DVD with a debug build of the Qt library results in this assertion failure: ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread a8625e78. Receiver 'aa_OSD_SUBTITLES' (of type 'MythScreenType?') was created in thread 9890750", file kernel/qcoreapplication.cpp, line 349
Backtrace & patch attached
Attachments (2)
Change History (13)
Changed 12 years ago by
Attachment: | video-backtrace.txt added |
---|
Changed 12 years ago by
Attachment: | 0001-libmythui-Fix-an-assert-failure-in-Qt-when-playing-a.patch added |
---|
comment:1 Changed 12 years ago by
Component: | MythTV - Video Playback → MythTV - Captions |
---|---|
Owner: | set to Jim Stichnoth |
Status: | new → assigned |
comment:2 Changed 12 years ago by
comment:3 Changed 12 years ago by
Milestone: | unknown → 0.25.1 |
---|---|
Status: | assigned → accepted |
In this case, the MythUI objects are actually created in the UI thread, but the decoder is trying to clear/delete them. This makes me realize there is a race condition here that needs to be addressed in the SubtitleScreen? class, which as a side effect will let us avoid the more invasive change to MythUIType.
comment:6 Changed 12 years ago by
Component: | MythTV - Captions → MythTV - Video Playback |
---|---|
Resolution: | → Fixed |
Status: | accepted → closed |
Lawrence, I believe this should be fixed, but I don't have a good way to test it, so I'd appreciate it if you could retest and reopen the ticket if you see the same problem.
Fundamentally, this turned out to be a video playback problem, rather than MythUI or captions.
comment:7 Changed 12 years ago by
Confirm fixed in commit b695979.
NB I would strongly recommend testing with a debug build of Qt (and many of the other libraries used by Myth) as they check & report warnings and errors for many API calls. It's very easy to build MythTV with a debug Qt by using my mythbuild.sh script from mythpackaging or here: http://www.softsystem.co.uk/download/mythtv/mythbuild.sh. Once you've got the script then run it:
mythbuild.sh -H -d -b master
-H :build for the host (default is xcompile to win32)
-d : Debug build
-b : Select mythtv branch
It will automatically download all the lib sources required.
If you want to use an existing mythtv git repo then cd to the parent of the repo and mv or ln -s the repo to mythtv and run mythbuild.sh from that directory - it will use the currently checked out branch.
Jim, this is a real issue but Lawrence's patch fixes a side effect and not the root cause. The problem is that MythUI objects need to be owned by and for the most part interacted with only in the main UI thread.
In this case the objects are probably created in the decoder thread. They either need to be created in the UI thread or re-parented to the UI thread when the decoder passes them along to the UI thread for rendering. Using deleteLater() here might just trade an ASSERT for a memory leak, if the thread that created the objects isn't running a Qt event loop.