Skip to content

Commit

Permalink
Cleanup OSD::DialogShow(), this code had the potential to segfault if…
Browse files Browse the repository at this point in the history
… the theme was missing a dialogue definition.
  • Loading branch information
stuartm committed May 31, 2012
1 parent 1d7922c commit ca9086d
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions mythtv/libs/libmythtv/osd.cpp
Expand Up @@ -990,38 +990,37 @@ void OSD::DialogShow(const QString &window, const QString &text, int updatefor)
{
OverrideUIScale();
MythScreenType *dialog;

if (window == OSD_DLG_EDITOR)
dialog = new ChannelEditor(m_ParentObject, window.toLatin1());
else if (window == OSD_DLG_CONFIRM)
dialog = new MythConfirmationDialog(NULL, text, false);
else
dialog = new MythDialogBox(text, NULL, window.toLatin1(), false, true);

if (dialog)
dialog->SetPainter(m_CurrentPainter);
if (dialog->Create())
{
dialog->SetPainter(m_CurrentPainter);
if (dialog->Create())
PositionWindow(dialog);
m_Dialog = dialog;
MythDialogBox *dbox = dynamic_cast<MythDialogBox*>(m_Dialog);
if (dbox)
dbox->SetReturnEvent(m_ParentObject, window);
MythConfirmationDialog *cbox = dynamic_cast<MythConfirmationDialog*>(m_Dialog);
if (cbox)
{
PositionWindow(dialog);
m_Dialog = dialog;
MythDialogBox *dbox = dynamic_cast<MythDialogBox*>(m_Dialog);
if (dbox)
dbox->SetReturnEvent(m_ParentObject, window);
MythConfirmationDialog *cbox = dynamic_cast<MythConfirmationDialog*>(m_Dialog);
if (cbox)
{
cbox->SetReturnEvent(m_ParentObject, window);
cbox->SetData("DIALOG_CONFIRM_X_X");
}
m_Children.insert(window, m_Dialog);
}
else
{
RevertUIScale();
delete dialog;
return;
cbox->SetReturnEvent(m_ParentObject, window);
cbox->SetData("DIALOG_CONFIRM_X_X");
}
m_Children.insert(window, m_Dialog);
}
else
{
RevertUIScale();
delete dialog;
return;
}

RevertUIScale();
}

Expand Down

0 comments on commit ca9086d

Please sign in to comment.