Save Data::Session* in GameData.

This commit is contained in:
John Preston 2021-10-11 21:46:51 +04:00
parent 2b11e45692
commit 01c1096c62
4 changed files with 17 additions and 19 deletions

View File

@ -407,6 +407,7 @@ PRIVATE
data/data_file_origin.cpp
data/data_file_origin.h
data/data_flags.h
data/data_game.cpp
data/data_game.h
data/data_group_call.cpp
data/data_group_call.h

View File

@ -0,0 +1,13 @@
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "data/data_game.h"
GameData::GameData(not_null<Data::Session*> owner, const GameId &id)
: owner(owner)
, id(id) {
}

View File

@ -11,25 +11,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document.h"
struct GameData {
GameData(const GameId &id) : id(id) {
}
GameData(
const GameId &id,
const uint64 &accessHash,
const QString &shortName,
const QString &title,
const QString &description,
PhotoData *photo,
DocumentData *document)
: id(id)
, accessHash(accessHash)
, shortName(shortName)
, title(title)
, description(description)
, photo(photo)
, document(document) {
}
GameData(not_null<Data::Session*> owner, const GameId &id);
const not_null<Data::Session*> owner;
GameId id = 0;
uint64 accessHash = 0;
QString shortName;

View File

@ -3041,7 +3041,7 @@ void Session::webpageApplyFields(
not_null<GameData*> Session::game(GameId id) {
auto i = _games.find(id);
if (i == _games.cend()) {
i = _games.emplace(id, std::make_unique<GameData>(id)).first;
i = _games.emplace(id, std::make_unique<GameData>(this, id)).first;
}
return i->second.get();
}