mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 17:49:14 +00:00
UI: Fix QLabel leak in OBSPropertiesView::AddProperty
OBS_PROPERTY_GROUP creates neither a widget nor a label, causing AddProperty to create a default one. Without a widget, it does not get attached to the layout, resulting in a memory leak. This commit also simplifies a bit of the code to avoid repeatedly testing the same condition.
This commit is contained in:
parent
799ac3f6a0
commit
40a598008d
|
@ -1452,27 +1452,32 @@ void OBSPropertiesView::AddProperty(obs_property_t *property,
|
|||
AddColorAlpha(property, layout, label);
|
||||
}
|
||||
|
||||
if (widget && !obs_property_enabled(property))
|
||||
widget->setEnabled(false);
|
||||
if (!widget && !label)
|
||||
return;
|
||||
|
||||
if (!label && type != OBS_PROPERTY_BOOL &&
|
||||
type != OBS_PROPERTY_BUTTON && type != OBS_PROPERTY_GROUP)
|
||||
label = new QLabel(QT_UTF8(obs_property_description(property)));
|
||||
|
||||
if (warning && label) //TODO: select color based on background color
|
||||
label->setStyleSheet("QLabel { color: red; }");
|
||||
if (label) {
|
||||
if (warning) //TODO: select color based on background color
|
||||
label->setStyleSheet("QLabel { color: red; }");
|
||||
|
||||
if (label && minSize) {
|
||||
label->setMinimumWidth(minSize);
|
||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
if (minSize) {
|
||||
label->setMinimumWidth(minSize);
|
||||
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
if (!obs_property_enabled(property))
|
||||
label->setEnabled(false);
|
||||
}
|
||||
|
||||
if (label && !obs_property_enabled(property))
|
||||
label->setEnabled(false);
|
||||
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
if (!obs_property_enabled(property))
|
||||
widget->setEnabled(false);
|
||||
|
||||
if (obs_property_long_description(property)) {
|
||||
bool lightTheme = palette().text().color().redF() < 0.5;
|
||||
QString file = lightTheme ? ":/res/images/help.svg"
|
||||
|
|
Loading…
Reference in a new issue