IOS-1495 missing weak in message View Model IOS-1521+IOS-1495
authorXavier Algarra <xavier@pep-project.org>
Fri, 17 May 2019 12:43:49 +0200
branchIOS-1521+IOS-1495
changeset 8663c91c1cbd1566
parent 8662 9f7c8a994889
child 8664 cd35355e45b6
IOS-1495 missing weak in message View Model
pEpForiOS/UI/EmailDisplayList/MessageViewModel.swift
     1.1 --- a/pEpForiOS/UI/EmailDisplayList/MessageViewModel.swift	Fri May 17 11:17:09 2019 +0200
     1.2 +++ b/pEpForiOS/UI/EmailDisplayList/MessageViewModel.swift	Fri May 17 12:43:49 2019 +0200
     1.3 @@ -325,12 +325,15 @@
     1.4  
     1.5      private func getBodyPeekOperation(for message: Message, completion: @escaping (String)->()) -> SelfReferencingOperation {
     1.6  
     1.7 -        let getBodyPeekOperation = SelfReferencingOperation {operation in
     1.8 +        let getBodyPeekOperation = SelfReferencingOperation { [weak self] operation in
     1.9              guard
    1.10                  let operation = operation,
    1.11                  !operation.isCancelled else {
    1.12                      return
    1.13              }
    1.14 +            guard let me = self else {
    1.15 +                return
    1.16 +            }
    1.17              let session = Session()
    1.18              session.performAndWait {
    1.19                  let safeMsg = message.safeForSession(session)
    1.20 @@ -342,7 +345,7 @@
    1.21                  guard !operation.isCancelled else {
    1.22                      return
    1.23                  }
    1.24 -                self.internalBoddyPeek = summary
    1.25 +                me.internalBoddyPeek = summary
    1.26                  if(!operation.isCancelled){
    1.27                      DispatchQueue.main.async {
    1.28                          completion(summary)