Abort request when PackageList gets deleted

This is a consequence of lazy loading and the re-loading we do when the Marketplace window gets closed. This solves a crash with reproduction steps:
1. Open the Marketplace.
2. Quickly close the Marketplace.
3. Quickly re-open the Marketplace.
4. The API responds to the request made by the first opening of the Marketplace.

This crashed because when the Marketplace first opened, it made a request to the API with the HttpRequestManager. This request takes a while to respond to. If you close and re-open the Marketplace, the PackageList gets destroyed and a new one gets made. The HttpRequestManager eventually gets a response and wants to call the callback of the first PackageList, but that one got destroyed in the Qt engine so it'll throw an error saying that the object doesn't exist any more.

Contributes to issue CURA-8557.
This commit is contained in:
Ghostkeeper 2021-10-29 10:10:57 +02:00
parent 4b86f7bb29
commit 3e64b7cb66
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A
2 changed files with 30 additions and 15 deletions

View file

@ -14,6 +14,7 @@ ScrollView
property alias model: pluginColumn.model
Component.onCompleted: model.request()
Component.onDestruction: model.abortRequest()
ListView
{