Accidental file delete on mobile.

Dirk Hohndel dirk at hohndel.org
Mon Jan 18 12:40:29 PST 2021



> On Jan 18, 2021, at 12:11 PM, Chirana Gheorghita Eugeniu Theodor <office at adaptcom.ro> wrote:
> 
> Ps. I just create a new dive and save, no fields completed. all blank... maibe this is.... let me test
> 
> So 
> 
> new dive > save > long press or using 3 dots to delete crashes app
> 
> 2. new dive > complete dive location > save > long press or context to delete does not crash app anymore :)
> 
> So I guess the default "unnamed dive site" type of entry is the culprit


Interesting. Even with that I cannot reproduce the crash on my Android phone, but at least
this gives me something else to look into. Hmmm. What is special about a dive that has
no valid data attached to it (BTW: I had considered in the past to not even add a dive that
has neither a depth nor a duration).

I'm still not seeing it, I'm still not getting which object we are creating in QML that has a
signal handler still running. I wish the debug message from QML was a little more useful.
How about if it told me what type of object it was that still had a handler running...

Hmmm.

So the log says that the handler was running ContextDrawerActionItem.qml line 84.
That's the code in Kirigami that executes the action that you clicked on / tapped.
So that seems to say that we are deleted the action itself. And that kinda makes sense,
because I bet that when we make an action invisible, it deletes the object from the parents
list of children or something like that.

And the action becomes invisible, once the currentItem on the dive list goes away. Which
conceivably could happen while we still aren't done with the QMLManager::deleteDive() 
call in the signal handler.

So this is a classic race condition. But how do I prevent this...

OK, I have a crazy idea. If I implement a transition that slowly hides the item instead of
just turning it off. Yeah, kinda silly, but... what if that's enough to keep the object around
long enough that the signal handler can complete.

OK, I'll try that and push a new binary out.
Stay tuned for another attempt (of course I don't know how long it will take for Google
to push things)

/D



More information about the subsurface mailing list