Add some assertions for debugging a crash.

This commit is contained in:
John Preston 2024-01-25 18:30:05 +04:00
parent 3c150d9742
commit 7dfb93f7c2
2 changed files with 7 additions and 1 deletions

View file

@ -881,6 +881,8 @@ void AttachWebView::request(const WebViewButton &button) {
}
void AttachWebView::cancel() {
Expects(!_catchingCancelInShowCall);
ActiveWebViews().remove(this);
_session->api().request(base::take(_requestId)).cancel();
_session->api().request(base::take(_prolongId)).cancel();
@ -1468,6 +1470,7 @@ void AttachWebView::show(
_lastShownQueryId = queryId;
_lastShownButtonText = buttonText;
base::take(_panel);
_catchingCancelInShowCall = true;
_panel = Ui::BotWebView::Show({
.url = url,
.userDataPath = _session->domain().local().webviewDataPath(),
@ -1477,11 +1480,13 @@ void AttachWebView::show(
.menuButtons = buttons,
.allowClipboardRead = allowClipboardRead,
});
_catchingCancelInShowCall = false;
started(queryId);
}
void AttachWebView::started(uint64 queryId) {
Expects(_bot != nullptr && _context != nullptr);
Expects(_bot != nullptr);
Expects(_context != nullptr);
if (_context->fromSwitch || !queryId) {
return;

View file

@ -267,6 +267,7 @@ private:
base::flat_set<not_null<UserData*>> _disclaimerAccepted;
std::unique_ptr<Ui::BotWebView::Panel> _panel;
bool _catchingCancelInShowCall = false;
};