mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add some assertions for debugging a crash.
This commit is contained in:
parent
3c150d9742
commit
7dfb93f7c2
2 changed files with 7 additions and 1 deletions
|
@ -881,6 +881,8 @@ void AttachWebView::request(const WebViewButton &button) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachWebView::cancel() {
|
void AttachWebView::cancel() {
|
||||||
|
Expects(!_catchingCancelInShowCall);
|
||||||
|
|
||||||
ActiveWebViews().remove(this);
|
ActiveWebViews().remove(this);
|
||||||
_session->api().request(base::take(_requestId)).cancel();
|
_session->api().request(base::take(_requestId)).cancel();
|
||||||
_session->api().request(base::take(_prolongId)).cancel();
|
_session->api().request(base::take(_prolongId)).cancel();
|
||||||
|
@ -1468,6 +1470,7 @@ void AttachWebView::show(
|
||||||
_lastShownQueryId = queryId;
|
_lastShownQueryId = queryId;
|
||||||
_lastShownButtonText = buttonText;
|
_lastShownButtonText = buttonText;
|
||||||
base::take(_panel);
|
base::take(_panel);
|
||||||
|
_catchingCancelInShowCall = true;
|
||||||
_panel = Ui::BotWebView::Show({
|
_panel = Ui::BotWebView::Show({
|
||||||
.url = url,
|
.url = url,
|
||||||
.userDataPath = _session->domain().local().webviewDataPath(),
|
.userDataPath = _session->domain().local().webviewDataPath(),
|
||||||
|
@ -1477,11 +1480,13 @@ void AttachWebView::show(
|
||||||
.menuButtons = buttons,
|
.menuButtons = buttons,
|
||||||
.allowClipboardRead = allowClipboardRead,
|
.allowClipboardRead = allowClipboardRead,
|
||||||
});
|
});
|
||||||
|
_catchingCancelInShowCall = false;
|
||||||
started(queryId);
|
started(queryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachWebView::started(uint64 queryId) {
|
void AttachWebView::started(uint64 queryId) {
|
||||||
Expects(_bot != nullptr && _context != nullptr);
|
Expects(_bot != nullptr);
|
||||||
|
Expects(_context != nullptr);
|
||||||
|
|
||||||
if (_context->fromSwitch || !queryId) {
|
if (_context->fromSwitch || !queryId) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -267,6 +267,7 @@ private:
|
||||||
base::flat_set<not_null<UserData*>> _disclaimerAccepted;
|
base::flat_set<not_null<UserData*>> _disclaimerAccepted;
|
||||||
|
|
||||||
std::unique_ptr<Ui::BotWebView::Panel> _panel;
|
std::unique_ptr<Ui::BotWebView::Panel> _panel;
|
||||||
|
bool _catchingCancelInShowCall = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue