Avoid a crash in QMessageBoxDetailsText, just in case

Change-Id: I3322767363c34ad1f131b6ef24e274e5e5cc9f16
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
Fan PengCheng 2021-03-22 13:53:02 +08:00
parent df121fd7f7
commit b6fe187f0d

View File

@ -100,8 +100,11 @@ public:
void contextMenuEvent(QContextMenuEvent * e) override
{
QMenu *menu = createStandardContextMenu();
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(e->globalPos());
if (menu)
{
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->popup(e->globalPos());
}
}
#endif // QT_NO_CONTEXTMENU
};