Skip to content

proper cleanup in RemoteLogosObject#53

Open
dlipicar wants to merge 1 commit into
masterfrom
fix-sigsegv
Open

proper cleanup in RemoteLogosObject#53
dlipicar wants to merge 1 commit into
masterfrom
fix-sigsegv

Conversation

@dlipicar
Copy link
Copy Markdown
Contributor

@dlipicar dlipicar commented Apr 17, 2026

Fixes this crash:

Screen.Recording.2026-04-17.at.11.03.27.mov

RemoteLogosObject::~RemoteLogosObject() — now releases m_replica via deleteLater(). Previously the destructor only freed m_helper and the QRemoteObjectDynamicReplica was leaked. Each invokeRemoteMethod accumulated a replica on the QRemoteObjectNode's name→replica map; eventually a fresh acquireDynamic("accounts_module") walked the map into a stale entry and setReplicaImplementation jumped through the corrupted vtable (PC=0x50000). deleteLater rather than raw delete so the node's destroyed-signal wiring deregisters cleanly without re-entering the node mid-dispatch.

RemoteTransportConnection::requestObject timeout path — switched the delete replica; to replica->deleteLater(); for the same reason. Raw-deleting a replica still tracked by the node leaves the map pointing at freed memory.
Why intermittent: needs enough prior calls into the same module to corrupt the map; the first few calls usually return cleanly because the stale entries haven't been hit yet.

Fixes an intermittent bug

Copilot AI review requested due to automatic review settings April 17, 2026 04:16
@dlipicar dlipicar requested a review from iurimatias April 17, 2026 04:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves lifecycle management of Qt Remote Objects replicas to avoid leaks and crashes caused by premature deletion while QRemoteObjectNode is still tracking replicas.

Changes:

  • Switch RemoteLogosObject destructor cleanup to release the replica via deleteLater() instead of immediate deletion.
  • Switch RemoteTransportConnection::requestObject() timeout cleanup to use deleteLater() for acquired dynamic replicas, with added rationale comments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cpp/implementations/qt_remote/remote_transport.cpp Outdated
@dlipicar dlipicar marked this pull request as draft April 17, 2026 12:36
@dlipicar dlipicar force-pushed the fix-sigsegv branch 4 times, most recently from 32236d3 to f8aac11 Compare April 18, 2026 22:58
@dlipicar dlipicar marked this pull request as ready for review April 20, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants