[mythtv-commits] Ticket #11383: Closing a screen when using the Qt painter can segfault

MythTV noreply at mythtv.org
Sun Jan 27 10:32:44 UTC 2013


#11383: Closing a screen when using the Qt painter can segfault
-------------------------------------------------+-------------------------
     Reporter:  paulh <mythtv@…>                 |      Owner:  stuartm
         Type:  Bug Report - Crash               |     Status:  new
     Priority:  minor                            |  Milestone:  unknown
    Component:  MythTV - User Interface Library  |    Version:  Master Head
     Severity:  medium                           |   Keywords:
Ticket locked:  0                                |
-------------------------------------------------+-------------------------
 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()

 2. MythScreenType::keyPressEvent() then calls MythScreenType::Close()
 which then calls MythScreenStack::PopScreen()

 3. 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().

 4. 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.

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/11383>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list