[Interest] QML StackView: cannot push while already in the process of completing a push
Mitch Curtis
mitch.curtis at qt.io
Wed Jul 22 09:14:00 CEST 2020
Hi.
> -----Original Message-----
> From: Interest <interest-bounces at qt-project.org> On Behalf Of Alexander
> Dyagilev
> Sent: Wednesday, 22 July 2020 3:31 AM
> To: interest at qt-project.org
> Subject: [Interest] QML StackView: cannot push while already in the process
> of completing a push
>
> Hello,
>
> Qt 5.12.8, Android 10.
>
>
> We're getting the subject message in app log when trying to push an item in
> some occasions. And thus the item is not pushed.
>
>
> Is it a bug? We've tried to use this custom component with no luck:
I can't test your example because there's no way to interact with it, but the message you're seeing was added in this change:
https://codereview.qt-project.org/c/qt/qtquickcontrols2/+/301988
It should only occur when pushing recursively - i.e. pushing in response to an earlier push (as might be encountered by handling onDepthChanged by pushing another item), before the push function has finished executing.
If you believe your application shouldn't be receiving the message, please provide a minimal reproducible example and I'll take a look.
Cheers.
> import QtQuick 2.0
>
> import QtQuick.Controls 2.12
>
> StackView
> {
> property var queue: []
>
> function queuedPush(item, properties, operation) {
> var pushedOk = false;
> if (!isBusy())
> {
> if (push(item, properties, operation))
> pushedOk = true;
> }
> if (!pushedOk)
> {
> console.log("queuing item");
> queue.push({i: item, p: properties, o: operation});
> }
> }
>
> function queuedClear() {
> queue = [];
> clear();
> }
>
> function isBusy() {
> return busy || state == StackView.Deactivating || state ==
> StackView.Activating;
> }
>
> function checkQueue() {
> console.log("checking queue");
> if (!isBusy() && !queue.empty) {
> console.log("pushing...");
> var item = queue.shift();
> push(item.i, item.p, item.o);
> }
> }
>
> onBusyChanged: checkQueue()
> onStateChanged: checkQueue()
> }
More information about the Interest
mailing list