Fix crash in SearchController.
Data::Histories cancels request in Main::Session::api(), so the request must be sent using this global api(), not custom MTP::Sender.
This commit is contained in:
parent
cc95117e9b
commit
844e9b60dd
|
@ -194,8 +194,7 @@ SearchController::CacheEntry::CacheEntry(const Query &query)
|
|||
}
|
||||
|
||||
SearchController::SearchController(not_null<Main::Session*> session)
|
||||
: _session(session)
|
||||
, _api(session->api().instance()) {
|
||||
: _session(session) {
|
||||
}
|
||||
|
||||
bool SearchController::hasInCache(const Query &query) const {
|
||||
|
@ -372,7 +371,7 @@ void SearchController::requestMore(
|
|||
const auto type = ::Data::Histories::RequestType::History;
|
||||
const auto history = _session->data().history(listData->peer);
|
||||
auto requestId = histories.sendRequest(history, type, [=](Fn<void()> finish) {
|
||||
return _api.request(
|
||||
return _session->api().request(
|
||||
std::move(*prepared)
|
||||
).done([=](const MTPmessages_Messages &result) {
|
||||
listData->requests.remove(key);
|
||||
|
|
|
@ -130,7 +130,6 @@ private:
|
|||
Data *listData);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
MTP::Sender _api;
|
||||
Cache _cache;
|
||||
Cache::iterator _current = _cache.end();
|
||||
|
||||
|
|
Loading…
Reference in New Issue