Bug 515904

Summary: Kaidan 0.15.0 (Flatpak) crashes when receiving an incoming contact request (<presence type="subscribe"/>) from another XMPP client.
Product: [Applications] kaidan Reporter: Ralf Peter <dinox>
Component: generalAssignee: melvo
Status: REPORTED ---    
Severity: crash    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ralf Peter 2026-02-12 12:21:56 UTC
Steps to reproduce:

Create account on Kaidan (e.g. om@example.org)
From a different client (e.g. Dinox), add om@example.org as contact
Kaidan crashes immediately
Note: Sending contact requests from Kaidan to Dinox works fine. The crash only happens on incoming requests.

Probable cause:

In src/OmemoController.cpp, function initializeChat():
if (RosterModel::instance()->item(m_accountSettings->jid(), jid)->isReceivingPresence()) {
RosterModel::instance()->item(...) returns std::optional<RosterItem>.

When an incoming subscription request is received, RosterController::handleSubscriptionRequest() calls processSubscriptionRequestFromStranger() which calls addContact() — but this is asynchronous (roster IQ set + server response). Before the roster item exists, Kaidan appears to open the chat view, which triggers initializeChat(). At this point, item() returns std::nullopt, and dereferencing it with ->isReceivingPresence() causes undefined behavior / segfault.

Side effect: After the crash, Kaidan's OMEMO database appears to be corrupted — after restart, OMEMO encryption no longer works for any contact (not just the one that triggered the crash). Only unencrypted messages can be sent.
Otherwise, Omemo 2 works wonderfully between Kaidan and Dinox.

Environment:

Kaidan 0.15.0 (Flatpak, im.kaidan.kaidan)
Linux (Flatpak system install)
ejabberd server 26.1

Ralf Peter