mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 21:34:10 -05:00
Merge pull request #1825 from G10h4ck/android_fix_debug_crash
Fix crash on Android due to dangling reference
This commit is contained in:
commit
e5b53e5646
@ -465,14 +465,17 @@ void JsonApiServer::registerHandler(
|
|||||||
const std::shared_ptr<rb::Session> session,
|
const std::shared_ptr<rb::Session> session,
|
||||||
const std::function<void (const std::shared_ptr<rb::Session>)>& callback )
|
const std::function<void (const std::shared_ptr<rb::Session>)>& callback )
|
||||||
{
|
{
|
||||||
|
/* Declare outside the lambda to avoid returning a dangling
|
||||||
|
* reference on Android */
|
||||||
|
RsWarn tWarn;
|
||||||
const auto authFail =
|
const auto authFail =
|
||||||
[&path, &session](int status) -> RsWarn::stream_type&
|
[&](int status) -> RsWarn::stream_type&
|
||||||
{
|
{
|
||||||
/* Capture session by reference as it is cheaper then copying
|
/* Capture session by reference as it is cheaper then copying
|
||||||
* shared_ptr by value which is not needed in this case */
|
* shared_ptr by value which is not needed in this case */
|
||||||
|
|
||||||
session->close(status, corsOptionsHeaders);
|
session->close(status, corsOptionsHeaders);
|
||||||
return RsWarn() << "JsonApiServer authentication handler "
|
return tWarn << "JsonApiServer authentication handler "
|
||||||
"blocked an attempt to call JSON API "
|
"blocked an attempt to call JSON API "
|
||||||
"authenticated method: " << path;
|
"authenticated method: " << path;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user