mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
io/fileview: write values into correct JsonObjects in deserialize
Property writes were being done on the JsonAdapter and not the child JsonObject, resulting in the data of children being set on the adapter's props, and occasional crashes.
This commit is contained in:
2 files changed
+4
-3
No files matched your search
@@ -66,6 +66,7 @@ set shell id.
|
||||
- Worked around Qt bug causing crashes when plugging and unplugging monitors.
|
||||
- Fixed HyprlandFocusGrab crashing if windows were destroyed after being passed to it.
|
||||
- Fixed ScreencopyView pixelation when scaled.
|
||||
- Fixed JsonAdapter crashing and providing bad data on read when using JsonObject.
|
||||
|
||||
## Packaging Changes
|
||||
|
||||
|
||||
@@ -155,13 +155,13 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
|
||||
|
||||
if (prop.metaType() == QMetaType::fromType<QVariant>()) {
|
||||
auto variant = jval.toVariant();
|
||||
auto oldValue = prop.read(this).value<QJSValue>();
|
||||
auto oldValue = prop.read(obj).value<QJSValue>();
|
||||
|
||||
// Calling prop.write with a new QJSValue will cause a property update
|
||||
// even if content is identical.
|
||||
if (jval.toVariant() != oldValue.toVariant()) {
|
||||
auto jsValue = qmlEngine(this)->fromVariant<QJSValue>(jval.toVariant());
|
||||
prop.write(this, QVariant::fromValue(jsValue));
|
||||
prop.write(obj, QVariant::fromValue(jsValue));
|
||||
}
|
||||
} else if (QMetaType::canView(prop.metaType(), QMetaType::fromType<JsonObject*>())) {
|
||||
// FIXME: This doesn't support creating descendants of JsonObject, as QMetaType.metaObject()
|
||||
@@ -196,7 +196,7 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
|
||||
QMetaType::fromType<QQmlListProperty<JsonObject>>()
|
||||
))
|
||||
{
|
||||
auto pval = prop.read(this);
|
||||
auto pval = prop.read(obj);
|
||||
|
||||
if (pval.canConvert<QQmlListProperty<JsonObject>>()) {
|
||||
auto lp = pval.value<QQmlListProperty<JsonObject>>();
|
||||
|
||||
Reference in new issue
Block a user