fix(delete): fix closing the app before login would make it crash

Fixes #12880
This commit is contained in:
Jonathan Rainville 2023-11-27 13:15:26 -05:00
parent ce0dbe533b
commit 7c7ab85690
5 changed files with 16 additions and 4 deletions

View File

@ -477,7 +477,7 @@ proc finishAppLoading*(self: AppController) =
self.privacyService.removeMnemonic()
if not self.startupModule.isNil:
self.startupModule.delete
self.startupModule.onAppLoaded()
self.startupModule = nil
self.mainModule.checkAndPerformProfileMigrationIfNeeded()

View File

@ -44,7 +44,7 @@ QtObject:
self.canSend = canSend
proc delete*(self: AccountItem) =
self.QObject.delete
self.QObject.delete
proc newAccountItem*(
name: string = "",

View File

@ -35,11 +35,13 @@ QtObject:
proc delete*(self: View) =
self.accounts.delete
self.senderAccounts.delete
self.selectedSenderAccount.delete
if self.selectedSenderAccount != nil:
self.selectedSenderAccount.delete
self.fromNetworksModel.delete
self.toNetworksModel.delete
self.transactionRoutes.delete
self.selectedReceiveAccount.delete
if self.selectedSenderAccount != nil:
self.selectedReceiveAccount.delete
self.QObject.delete
proc newView*(delegate: io_interface.AccessInterface): View =

View File

@ -19,6 +19,9 @@ type
method delete*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method onAppLoaded*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method load*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -84,6 +84,13 @@ proc newModule*[T](delegate: T,
{.push warning[Deprecated]: off.}
method delete*[T](self: Module[T]) =
self.view.delete
self.viewVariant.delete
self.controller.delete
if not self.keycardSharedModule.isNil:
self.keycardSharedModule.delete
method onAppLoaded*[T](self: Module[T]) =
singletonInstance.engine.setRootContextProperty("startupModule", newQVariant())
self.view.delete
self.view = nil