2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use std::function for base::lambda implementation.

base::lambda becomes just std::function and base::lambda_once becomes
base::unique_function - a move-only wrapper around std::function.

This is required because Visual C++ 2017 15.4.1 has a compiler bug
with static member variables of class templates, they may collide.

The std::function uses inheritance and virtual functions instead of
custom vtables done by static members of class templates used in
custom base::lambda implementation, so they work fine.
This commit is contained in:
John Preston
2017-10-27 18:37:27 +03:00
parent fde3ff1bbf
commit 101d4f6444
6 changed files with 377 additions and 72 deletions

View File

@@ -208,7 +208,11 @@ namespace {
void logOut() {
if (auto mtproto = Messenger::Instance().mtp()) {
mtproto->logout(rpcDone(&loggedOut), rpcFail(&loggedOut));
mtproto->logout(rpcDone([] {
return loggedOut();
}), rpcFail([] {
return loggedOut();
}));
} else {
// We log out because we've forgotten passcode.
// So we just start mtproto from scratch.