Fix several possible crashes.

This commit is contained in:
John Preston 2024-01-18 22:22:17 +04:00
parent f53b64bc72
commit e4ca8ae847
3 changed files with 22 additions and 6 deletions

View File

@ -522,9 +522,23 @@ not_null<Ui::SlideWrap<>*> Controller::addRequestedListBlock(
lt_count_decimal,
std::move(requestedCount)));
const auto delegate = container->lifetime().make_state<
PeerListContentDelegateSimple
>();
class Delegate final : public PeerListContentDelegateSimple {
public:
explicit Delegate(std::shared_ptr<Main::SessionShow> show)
: _show(std::move(show)) {
}
std::shared_ptr<Main::SessionShow> peerListUiShow() override {
return _show;
}
private:
const std::shared_ptr<Main::SessionShow> _show;
};
const auto delegate = container->lifetime().make_state<Delegate>(
this->delegate()->peerListUiShow());
const auto controller = container->lifetime().make_state<
Controller
>(_peer, _data.current().admin, _data.value(), Role::Requested);

View File

@ -936,16 +936,18 @@ void ShareBox::Inner::loadProfilePhotos() {
const auto from = std::max(yFrom / _rowHeight, 0);
const auto to = std::max((yTo / _rowHeight) + 1, from);
const auto ffrom = from;
const auto fto = std::min(to, int(_filtered.size()));
const auto ffrom = std::min(from, fto);
for (auto i = ffrom; i != fto; ++i) {
preloadUserpic(_filtered[i]->entry());
}
const auto ufrom = std::max(from - int(_filtered.size()), 0);
const auto uto = std::min(
to - int(_filtered.size()),
int(d_byUsernameFiltered.size()));
const auto ufrom = std::min(
std::max(from - int(_filtered.size()), 0),
uto);
for (auto i = ufrom; i != uto; ++i) {
preloadUserpic(d_byUsernameFiltered[i]->history);
}

@ -1 +1 @@
Subproject commit 30b22ace0b67f72e2ab913fccf56842b863effad
Subproject commit a2c2d92cda2cffdafeb671d1f292a2002fb54217