mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-08-31 09:41:06 +00:00
Address review: async marshaling, helper constraints, test ownership
- invokeRemoteMethodAsync now also marshals to the owner thread (non-blocking QueuedConnection) — the async path acquires a replica too, so calling it from a worker thread previously re-introduced the off-thread bug. - runOnOwnerThread: document the return-type constraints (void or default-constructible, non-reference) and static_assert against references. - test: declare the provider before its LogosAPI so the ModuleProxy (which holds a raw pointer to it) is torn down first — removes the leak and the inaccurate comment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
43532db796
commit
c6e909673e
@@ -144,6 +144,21 @@ void LogosAPIClient::invokeRemoteMethodAsync(const QString& objectName, const QS
|
||||
{
|
||||
if (!callback) return;
|
||||
|
||||
// The async path acquires a replica too, so it must also run on the owner
|
||||
// thread. Unlike the sync path we post non-blocking (QueuedConnection): the
|
||||
// worker caller returns immediately and the result callback fires on the
|
||||
// owner thread when the reply arrives.
|
||||
if (QThread::currentThread() != this->thread()) {
|
||||
QMetaObject::invokeMethod(this,
|
||||
[this, objectName, methodName, args,
|
||||
callback = std::move(callback), timeout]() mutable {
|
||||
invokeRemoteMethodAsync(objectName, methodName, args,
|
||||
std::move(callback), timeout);
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
return;
|
||||
}
|
||||
|
||||
QString token = getToken(objectName);
|
||||
|
||||
if (token.isEmpty() && objectName != "capability_module" && m_capability_consumer) {
|
||||
|
||||
Reference in New Issue
Block a user