fix(QAbstractItemModel): Fixing memory leaks and crash when using startupModule after the object is deleted
This commit is contained in:
parent
8a2bb3e40f
commit
79b4d7638a
|
@ -281,6 +281,7 @@ proc delete*(self: AppController) =
|
|||
self.gifService.delete
|
||||
if not self.startupModule.isNil:
|
||||
self.startupModule.delete
|
||||
self.startupModule = nil
|
||||
self.mainModule.delete
|
||||
self.languageService.delete
|
||||
|
||||
|
@ -460,6 +461,7 @@ proc finishAppLoading*(self: AppController) =
|
|||
|
||||
if not self.startupModule.isNil:
|
||||
self.startupModule.delete
|
||||
self.startupModule = nil
|
||||
|
||||
proc logout*(self: AppController) =
|
||||
self.generalService.logout()
|
||||
|
|
|
@ -65,11 +65,16 @@ proc newModule*[T](delegate: T,
|
|||
profileService, keycardService)
|
||||
|
||||
method delete*[T](self: Module[T]) =
|
||||
singletonInstance.engine.setRootContextProperty("startupModule", newQVariant())
|
||||
self.view.delete
|
||||
self.view = nil
|
||||
self.viewVariant.delete
|
||||
self.viewVariant = nil
|
||||
self.controller.delete
|
||||
self.controller = nil
|
||||
if not self.keycardSharedModule.isNil:
|
||||
self.keycardSharedModule.delete
|
||||
self.keycardSharedModule = nil
|
||||
|
||||
proc extractImages(self: Module, account: AccountDto, thumbnailImage: var string,
|
||||
largeImage: var string) =
|
||||
|
@ -394,10 +399,10 @@ method onNodeLogin*[T](self: Module[T], error: string) =
|
|||
if err.len > 0:
|
||||
self.logoutAndDisplayError(err, StartupErrorType.UnknownType)
|
||||
return
|
||||
self.delegate.finishAppLoading()
|
||||
if currStateObj.flowType() != FlowType.AppLogin:
|
||||
discard self.controller.storeIdentityImage()
|
||||
self.controller.cleanTmpData()
|
||||
self.delegate.finishAppLoading()
|
||||
else:
|
||||
self.moveToStartupState()
|
||||
if currStateObj.flowType() == FlowType.AppLogin:
|
||||
|
|
Loading…
Reference in New Issue