Skip to content

Fix crash when switching signed/encrypted emails very fast

Daniel Vrátil requested to merge work/dvratil/t6496 into release/23.04

Kleo::KeyCache internally uses a QEventLoop to block until it finishes initializing. The initialization happens the first time the user opens a signed or encrypted email. If they switch to another email before the KeyCache is done initializing it leads to a crash in MessageViewer, since message pointers change while MessageViewer is still "blocked" in OTP.

To avoid the crash, and running a nested event loop in general, this change introduces KeyCacheMemento, which allows to wait for the KeyCache to initialize asynchronously before the MessagePart queries it.

BUGS: 463083

Merge request reports