gsettings-qml biderectional list issue

Bug #1333460 reported by damianatorrpm@gmail.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gsettings-qt
Invalid
Undecided
Unassigned

Bug Description

Excuse the noise, it's my bad, found the status change button for the bug, marked as invalid.

GSettings-qt crashes when qlist (any list value in gsettings), below

  Example code:
  Binding {target: virtualDesktopSettings; property:"names"; value:windowSystem.desktopNames}
  Binding {target: windowSystem; property: "desktopNames"; value:virtualDesktopSettings.names}
//windowSystem is another cpp plugin exposing also virtual desktop names

    GSettings {id:virtualDesktopSettings;
        schema.id:"org.qmldesktop.virtualdesktops";
        schema.path:"/org/qmldesktop/virtualdesktops/";
    }

Scenario A:
 You close above application and change the value (as an example the names of the virtual desktops)
somehow externally via windowManager/Unity/KDE/etc
from [ "old_desktopname1", "old_desktopname2" ] to [ "new_desktopname1", "new_desktopname2" ]
and restart the application.
//This works

Scenario B:
 You close above application and change the value (as an example the names of the virtual desktops)
somehow externally via windowManager/Unity/KDE/etc
from [ "old_desktopname1", "old_desktopname2" ] to [ "new_desktopname1", "new_desktopname2", "new_desktopname3" ]
and restart the application.
//The length changed as we added an additional virtual desktop. Now the application just crashes:
//ASSERT failure in QList<T>::operator[]: "index out of range", file ../../Qt5.3.0/5.3/gcc_64/include/QtCore/qlist.h, line 487
//The program has unexpectedly finished.

Workaround:
//change example code to:
property bool startSync
Timer {running:true;interval:1000; onTriggered:startSync=true}
  Binding {target: virtualDesktopSettings; property:"names"; value:windowSystem.desktopNames}
  Binding {target: windowSystem; property: "desktopNames"; value:virtualDesktopSettings.names;when:(startSync)}
//windowSystem is another cpp plugin exposing also virtual desktop names

    GSettings {id:virtualDesktopSettings;
        schema.id:"org.qmldesktop.virtualdesktops";
        schema.path:"/org/qmldesktop/virtualdesktops/";
    }

PS:
Just wondering right now on such a bidirectional binding, if changed while application was not running which one should have precedence (when I set when: it's obvious)? Should GSettings enforce it's settings, or the other side enforce onto GSettings?
But this should be more of a Qt request for a true QML BiDirectionalBinding {}

Revision history for this message
damianatorrpm@gmail.com (damianatorrpm) wrote :

nevermind, the issue is not in gsettings tried with different testcase...

Revision history for this message
damianatorrpm@gmail.com (damianatorrpm) wrote :

please close

Changed in gsettings-qt:
status: New → Invalid
description: updated
description: updated
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.