mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04: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::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 =
|
||||
[&path, &session](int status) -> RsWarn::stream_type&
|
||||
[&](int status) -> RsWarn::stream_type&
|
||||
{
|
||||
/* Capture session by reference as it is cheaper then copying
|
||||
* shared_ptr by value which is not needed in this case */
|
||||
|
||||
session->close(status, corsOptionsHeaders);
|
||||
return RsWarn() << "JsonApiServer authentication handler "
|
||||
return tWarn << "JsonApiServer authentication handler "
|
||||
"blocked an attempt to call JSON API "
|
||||
"authenticated method: " << path;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user