mirror of
https://github.com/logos-co/logos-cpp-sdk.git
synced 2026-08-31 01:31:10 +00:00
fix async call crash (#49)
* fix async call crash * add regression test
This commit is contained in:
@@ -106,9 +106,15 @@ void LogosAPIConsumer::invokeRemoteMethodAsync(const QString& authToken, const Q
|
||||
QPointer<LogosAPIConsumer> self(this);
|
||||
plugin->callMethodAsync(authToken, methodName, args, timeout.ms,
|
||||
[plugin, callback, self](QVariant result) {
|
||||
plugin->release();
|
||||
if (!self) return;
|
||||
// Deliver the result before release(): destroying the replica can
|
||||
// invalidate storage that QVariant still references for some return
|
||||
// types (matches sync invokeRemoteMethod: callMethod then release).
|
||||
if (!self) {
|
||||
plugin->release();
|
||||
return;
|
||||
}
|
||||
callback(result);
|
||||
plugin->release();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user