mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10: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:
parent
50cdf98868
commit
aaff22f4b0
2 changed files with 4 additions and 3 deletions
|
|
@ -66,6 +66,7 @@ set shell id.
|
||||||
- Worked around Qt bug causing crashes when plugging and unplugging monitors.
|
- Worked around Qt bug causing crashes when plugging and unplugging monitors.
|
||||||
- Fixed HyprlandFocusGrab crashing if windows were destroyed after being passed to it.
|
- Fixed HyprlandFocusGrab crashing if windows were destroyed after being passed to it.
|
||||||
- Fixed ScreencopyView pixelation when scaled.
|
- Fixed ScreencopyView pixelation when scaled.
|
||||||
|
- Fixed JsonAdapter crashing and providing bad data on read when using JsonObject.
|
||||||
|
|
||||||
## Packaging Changes
|
## Packaging Changes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,13 +155,13 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
|
||||||
|
|
||||||
if (prop.metaType() == QMetaType::fromType<QVariant>()) {
|
if (prop.metaType() == QMetaType::fromType<QVariant>()) {
|
||||||
auto variant = jval.toVariant();
|
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
|
// Calling prop.write with a new QJSValue will cause a property update
|
||||||
// even if content is identical.
|
// even if content is identical.
|
||||||
if (jval.toVariant() != oldValue.toVariant()) {
|
if (jval.toVariant() != oldValue.toVariant()) {
|
||||||
auto jsValue = qmlEngine(this)->fromVariant<QJSValue>(jval.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*>())) {
|
} else if (QMetaType::canView(prop.metaType(), QMetaType::fromType<JsonObject*>())) {
|
||||||
// FIXME: This doesn't support creating descendants of JsonObject, as QMetaType.metaObject()
|
// 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>>()
|
QMetaType::fromType<QQmlListProperty<JsonObject>>()
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
auto pval = prop.read(this);
|
auto pval = prop.read(obj);
|
||||||
|
|
||||||
if (pval.canConvert<QQmlListProperty<JsonObject>>()) {
|
if (pval.canConvert<QQmlListProperty<JsonObject>>()) {
|
||||||
auto lp = pval.value<QQmlListProperty<JsonObject>>();
|
auto lp = pval.value<QQmlListProperty<JsonObject>>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue