proper cleanup in RemoteLogosObject#53
Open
dlipicar wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
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
RemoteLogosObjectdestructor cleanup to release the replica viadeleteLater()instead of immediate deletion. - Switch
RemoteTransportConnection::requestObject()timeout cleanup to usedeleteLater()for acquired dynamic replicas, with added rationale comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
32236d3 to
f8aac11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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