mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Add check for null widgetForAction result
In some cases, `QToolbar::widgetForAction` may return `nullptr`. This causes a crash on affected system. To mitigate this, we check for `widgetForAction` result and skip operating on a NULL widget.
This commit is contained in:
parent
d831e9403f
commit
213ce75328
|
@ -412,6 +412,10 @@ void RefreshToolBarStyling(QToolBar *toolBar)
|
|||
{
|
||||
for (QAction *action : toolBar->actions()) {
|
||||
QWidget *widget = toolBar->widgetForAction(action);
|
||||
|
||||
if (!widget)
|
||||
continue;
|
||||
|
||||
widget->style()->unpolish(widget);
|
||||
widget->style()->polish(widget);
|
||||
}
|
||||
|
|
|
@ -587,6 +587,9 @@ void OBSBasic::copyActionsDynamicProperties()
|
|||
for (QAction *x : ui->scenesToolbar->actions()) {
|
||||
QWidget *temp = ui->scenesToolbar->widgetForAction(x);
|
||||
|
||||
if (!temp)
|
||||
continue;
|
||||
|
||||
for (QByteArray &y : x->dynamicPropertyNames()) {
|
||||
temp->setProperty(y, x->property(y));
|
||||
}
|
||||
|
@ -595,6 +598,9 @@ void OBSBasic::copyActionsDynamicProperties()
|
|||
for (QAction *x : ui->sourcesToolbar->actions()) {
|
||||
QWidget *temp = ui->sourcesToolbar->widgetForAction(x);
|
||||
|
||||
if (!temp)
|
||||
continue;
|
||||
|
||||
for (QByteArray &y : x->dynamicPropertyNames()) {
|
||||
temp->setProperty(y, x->property(y));
|
||||
}
|
||||
|
@ -603,6 +609,9 @@ void OBSBasic::copyActionsDynamicProperties()
|
|||
for (QAction *x : ui->mixerToolbar->actions()) {
|
||||
QWidget *temp = ui->mixerToolbar->widgetForAction(x);
|
||||
|
||||
if (!temp)
|
||||
continue;
|
||||
|
||||
for (QByteArray &y : x->dynamicPropertyNames()) {
|
||||
temp->setProperty(y, x->property(y));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue