Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 15 months ago

Closed 13 months ago

Last modified 11 months ago

#11383 closed Bug Report - Crash (fixed)

Closing a screen when using the Qt painter can segfault

Reported by: paulh <mythtv@…> Owned by: paulh
Priority: minor Milestone: 0.26.1
Component: MythTV - User Interface Library Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

This has been observed when closing the volume popup in MythMusic but could affect any screen. To reproduce change to the Qt painter then:-

  1. Change the volume in MythMusic which shows the volume popup dialog.
  2. Immediately press ESCAPE to close the dialog.

What's happening is

  1. The keypressEvent gets passed to MythMusicVolumeDialog::keyPressEvent() which in turn passes it to MythScreenType::keyPressEvent()
  1. MythScreenType::keyPressEvent() then calls MythScreenType::Close() which then calls MythScreenStack::PopScreen?()
  1. Because we are using the Qt painter there is no fade effect or animation to do so the screen gets deleted right away in PopScreen?().
  1. At this point we return to MythMusicVolumeDialog::keyPressEvent() of the now deleted screen where any access to any members is going to segfault which is what happens in this case.

A simple generic fix would be to change in MythScreenStack::PopScreen?()

delete screen;

to

screen->deleteLater();

so the keypressEvent handlers could complete safely before the screen is eventually deleted when control returns to the event loop.

Attachments (0)

Change History (5)

comment:1 Changed 14 months ago by paulh <mythtv@…>

This has been confirmed to fix the segfault
https://github.com/paul-h/mythtv/commit/1b92f4c277

comment:2 Changed 13 months ago by Paul Harrison <mythtv@…>

  • Resolution set to fixed
  • Status changed from new to closed

In c713988707d2c795a2a2abeff817d1b187d4b3f6/mythtv:

Fix possible segfault when exiting a screen when using the Qt painter

This changes MythScreenStack::PopScreen?() to call deleteLater() on the
screen rather than immediately deleting it so as to allow any keypressEvent
handlers to complete safely before the screen is deleted when control
returns to the event loop.

Fixes #11383.

comment:3 Changed 13 months ago by wagnerrp

  • Milestone changed from unknown to 0.27

comment:4 Changed 11 months ago by Paul Harrison <mythtv@…>

In d1a48313dac5510795250c783bca2fe56ee6d7b1/mythtv:

Fix possible segfault when exiting a screen when using the Qt painter

This changes MythScreenStack::PopScreen?() to call deleteLater() on the
screen rather than immediately deleting it so as to allow any keypressEvent
handlers to complete safely before the screen is deleted when control
returns to the event loop.

Fixes #11383.
(cherry picked from commit c713988707d2c795a2a2abeff817d1b187d4b3f6)

comment:5 Changed 11 months ago by paulh

  • Milestone changed from 0.27 to 0.26.1
  • Owner changed from stuartm to paulh

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.