Fix deadlock

pull/220/head
nielsandriesse 5 years ago
parent c0b4a548bf
commit fcf0910e51

@ -733,6 +733,12 @@ typedef enum : NSUInteger {
[self.headerView updateSubtitleForCurrentStatus];
});
}
if ([self.thread isKindOfClass:TSContactThread.class]) {
[LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[SSKEnvironment.shared.profileManager ensureProfileCachedForContactWithID:self.thread.contactIdentifier with:transaction];
}];
}
}
- (void)createContents

@ -165,10 +165,11 @@ public final class MultiDeviceProtocol : NSObject {
let recipient = SignalRecipient.getOrBuildUnsavedRecipient(forRecipientId: hexEncodedPublicKey, transaction: transaction)
let udManager = SSKEnvironment.shared.udManager
let senderCertificate = udManager.getSenderCertificate()
SSKEnvironment.shared.profileManager.ensureProfileCachedForContact(withID: hexEncodedPublicKey, with: transaction) // Prevent the line below from starting a write transaction
let (promise, seal) = Promise<OWSMessageSend>.pending()
LokiAPI.workQueue.async {
var recipientUDAccess: OWSUDAccess?
if let senderCertificate = senderCertificate {
SSKEnvironment.shared.profileManager.ensureProfileCachedForContact(withID: hexEncodedPublicKey, with: transaction) // Prevent the line below from starting a write transaction
recipientUDAccess = udManager.udAccess(forRecipientId: hexEncodedPublicKey, requireSyncAccess: true)
}
let messageSend = OWSMessageSend(message: message, thread: thread, recipient: recipient, senderCertificate: senderCertificate,
@ -178,6 +179,7 @@ public final class MultiDeviceProtocol : NSObject {
externalSeal?.reject(error)
})
seal.fulfill(messageSend)
}
return promise
}

Loading…
Cancel
Save