From a98e92639c22690985109af31d50e7a649fe2923 Mon Sep 17 00:00:00 2001 From: ZavaruKitsu Date: Tue, 12 Dec 2023 15:26:33 +0300 Subject: [PATCH] fix: crash in server read --- Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp | 8 ++++---- Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.h | 4 ++-- Telegram/SourceFiles/data/data_histories.cpp | 8 ++++++-- Telegram/SourceFiles/window/window_main_menu.cpp | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp b/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp index 69d7adcd7..f04dee7da 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp +++ b/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.cpp @@ -18,7 +18,7 @@ namespace AyuUi { -ConfirmationBox::ConfirmationBox( +ServerReadConfirmationBox::ServerReadConfirmationBox( QWidget *, not_null controller) : _controller(controller) @@ -26,7 +26,7 @@ ConfirmationBox::ConfirmationBox( // } -void ConfirmationBox::prepare() +void ServerReadConfirmationBox::prepare() { _text.create(this, tr::ayu_ReadConfirmationBoxQuestion(), st::boxLabel); @@ -45,7 +45,7 @@ void ConfirmationBox::prepare() { closeBox(); }); } -void ConfirmationBox::resizeEvent(QResizeEvent *e) +void ServerReadConfirmationBox::resizeEvent(QResizeEvent *e) { BoxContent::resizeEvent(e); @@ -53,7 +53,7 @@ void ConfirmationBox::resizeEvent(QResizeEvent *e) _text->moveToLeft(padding.left(), padding.top()); } -void ConfirmationBox::ReadAllPeers() +void ServerReadConfirmationBox::ReadAllPeers() { auto settings = &AyuSettings::getInstance(); auto prev = settings->sendReadMessages; diff --git a/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.h b/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.h index d6f5f0cc3..44b2d22c2 100644 --- a/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.h +++ b/Telegram/SourceFiles/ayu/ui/boxes/confirmation_box.h @@ -12,10 +12,10 @@ namespace AyuUi { -class ConfirmationBox : public Ui::BoxContent +class ServerReadConfirmationBox : public Ui::BoxContent { public: - ConfirmationBox(QWidget *, not_null controller); + ServerReadConfirmationBox(QWidget *, not_null controller); protected: void prepare() override; diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index a60fdee48..6824531fa 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -623,8 +623,12 @@ void Histories::sendReadRequest(not_null history, State &state) { DEBUG_LOG(("Reading: sending request invoked with till %1." ).arg(tillId.bare)); const auto finished = [=] { - const auto state = lookup(history); - Assert(state != nullptr); + auto state = lookup(history); + // Assert(state != nullptr); + if (state == nullptr) { + // don’t care + didn’t ask + cry about it + who asked + stay mad + get real + L + bleed + mald seethe cope harder + dilate + incorrect + hoes mad + pound sand + basic skill issue + typo + ratio + ur dad left + you fell off + no u + the audacity + triggered + repelled + ur a minor + k. + any askers + get a life + ok and? + cringe + copium + go outside + touch grass + kick rocks + quote tweet + think again + not based + not funny didn’t laugh + social credits -999, 999, 999, 999 + get good + reported + ad hominem + ok boomer + small pp + ur allergic to sunlight + GG! + get rekt + trolled + your loss + muted + banned + kicked + permaban + useless + i slept with ur mom + yo momma + yo momma so fat + redpilled + no bitches allowed + i said it better + tiktok fan + get a life + unsubscribed + plundered + go tell reddit + donowalled + simp + get sticked bug LOL + talk nonsense + trump supporter + your’re a full time discord mod + you’re* + grammar issue + nerd + get clapped + kys + lorem ipsum dolor sit amet + go outside + bleach + lol + gay + retard + autistic + reported + ask deez + ez clap + straight cash + idgaf + ratio again + stay mad + read FAQ + youre lost + you “re” + stay pressed + reverse double take back + pedophile + cancelled + done for + don't give a damn + get a job + sus + baka + sussy baka + get blocked + mad free + freer than air + furry + rip bozo + you're a (insert stereotype) + slight_smile + aired + cringe again + Super Idol的笑容 + mad cuz bad + my pronouns are xe, xem & xyr + irrelevant + deal with it + screencapped your bio + karen/kyle + jealous + you're deaf + balls + i'll be right back + go ahead whine about it + not straight + eat paper + you lose + count to three + your problem + no one cares + log off + don't care even more + sex offender + sex defender + get religion + not okay + glhf + NFT owner + you make bad memes + problematic + fall in line + dog water + you look like a wall + you don’t know 2 + 2 with yo head ass + you are going to my cringe compilation + you can’t count to five + try again + you failed kindergarten + rickrolled + no lifer + guten freunden schickt man einen deutschen panzer + you have a anime profile picture + an* + fatherless + motherless + sisterless + brotherless + orphan + you can't catch this ratio + catch some bitches + I don't care about your opinion + genshin player + you dress like garbage + 日本語がお上手ですね + get fucked + you can’t understand what the word intelligence means with your dumb ass + you have hair + queued + put some thought into what you're going to do with that + stfu + go to bed + yes, i'm taller than you + i think your joke is funny + i rejected your mother's advances + marooned + you can’t read + I win + final ratio + state = &_states[history]; + } if (state->sentReadTill == tillId) { state->sentReadDone = true; diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index d29ed4d28..f2525d62c 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -982,7 +982,7 @@ void MainMenu::setupMenu() { {&st::ayuSReadMenuIcon} )->setClickedCallback([=] { - auto box = Box(controller); + auto box = Box(controller); Ui::show(std::move(box)); }); }