提交 db3614b5 编写于 作者: J jp9000

Always create new object when setting a sub-object

Do not use the object returned from obs_data_get_obj to set new
settings.  It could be the default object, which means you'd just end up
modifying the default data, which won't get saved.  Always create a new
object when setting sub-object data.  It doesn't particularly hurt
anything.
上级 1bbdcc10
......@@ -623,17 +623,13 @@ bool WidgetInfo::FontChanged(const char *setting)
} else {
MakeQFont(font_obj, font);
font = QFontDialog::getFont(&success, font, view);
obs_data_release(font_obj);
}
if (!success) {
obs_data_release(font_obj);
if (!success)
return false;
}
if (!font_obj) {
font_obj = obs_data_create();
obs_data_set_obj(view->settings, setting, font_obj);
}
font_obj = obs_data_create();
obs_data_set_string(font_obj, "face", QT_TO_UTF8(font.family()));
obs_data_set_string(font_obj, "style", QT_TO_UTF8(font.styleName()));
......@@ -648,6 +644,7 @@ bool WidgetInfo::FontChanged(const char *setting)
label->setFont(font);
label->setText(QString("%1 %2").arg(font.family(), font.styleName()));
obs_data_set_obj(view->settings, setting, font_obj);
obs_data_release(font_obj);
return true;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册