Opened 6 years ago

Closed 5 years ago

#12056 closed Patch - Bug Fix (Fixed)

Two cc608 mid-row codes in a row cause QPainter warning

Reported by: faginbagin <mythtv@…> Owned by: Jim Stichnoth
Priority: minor Milestone: 0.27.4
Component: MythTV - Captions Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

After porting the latest changes in master for closed captions to 0.27, and playing this video clip with VBI CCs enabled: http://ncamftp.wgbh.org/DTV/CEA%20test%20material/Iteration_1/CEAv1.2zero.trp the following messages are written several times to stderr by the Qt library:

QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::setFont: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::end: Painter not active, aborted

I'm pretty sure the same problem exists in master, I just don't have a master runtime environment to confirm it. I have confirmed the problem does not exist in 0.27-fixes.

Turns out the above complaints from Qt occur whenever two mid-row codes in a row are processed. They lead to:

  • a zero width textRect in FormattedTextChunk::PreRender?(),
  • which leads to creation of a QImage with no allocated data,
  • which leads to the complaints from QPainter.

You can also get Qt to abort and dump core at the point QPainter detects the problem, if you run mythfrontend with the environment variable, QT_FATAL_WARNINGS=1, and then play the above video clip. See http://qt-project.org/doc/qt-4.8/debug.html

Attached is a patch that tests for and fixes the zero width textRect. It fixes the problem in my 0.27-with-cc-changes-from-master environment and should fix it in master, too.

Attachments (1)

mid-row-zero-rect.patch (1.5 KB) - added by faginbagin <mythtv@…> 6 years ago.

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by faginbagin <mythtv@…>

Attachment: mid-row-zero-rect.patch added

comment:1 Changed 6 years ago by faginbagin <mythtv@…>

Forgot to mention that you can seek forward 3 minutes into the Iteration1 clip. The problematic mid-row codes are part of the demo described in slide 68, which starts soon after the clock displays 01:03:23:00.

comment:2 Changed 5 years ago by Jim Stichnoth

Milestone: unknown0.27.4
Status: newaccepted

comment:3 Changed 5 years ago by Jim Stichnoth <jstichnoth@…>

In 203db78ed2c8e9d59159d970b1eb89b5764a79f3/mythtv:

Subtitles: Avoid trying to draw empty text or background objects.

Otherwise it can result in QPainter error messages.

Thanks to faginbagin@ for identifying the root of the problem.
Refs #12056.

comment:4 Changed 5 years ago by Jim Stichnoth <jstichnoth@…>

In 0dd5ab38982619af18f99c4032c1010d68991047/mythtv:

Subtitles: Avoid trying to draw empty text or background objects.

Cherry-picked / adapted from 203db78ed2c8e9d59159d970b1eb89b5764a79f3.

Refs #12056

comment:5 Changed 5 years ago by Jim Stichnoth

Resolution: Fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.