mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Fix crash in forwarding messages.
HistoryHider holds pointers to items, so it should watch for the history items being removed and remove the pointers.
This commit is contained in:
parent
e0c74c9546
commit
a69304fd25
@ -208,6 +208,19 @@ HistoryHider::HistoryHider(MainWidget *parent, const QString &url, const QString
|
||||
|
||||
void HistoryHider::init() {
|
||||
subscribe(Lang::Current().updated(), [this] { refreshLang(); });
|
||||
if (!_forwardItems.empty()) {
|
||||
subscribe(Global::RefItemRemoved(), [this](HistoryItem *item) {
|
||||
for (auto i = _forwardItems.begin(); i != _forwardItems.end(); ++i) {
|
||||
if (i->get() == item) {
|
||||
i = _forwardItems.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_forwardItems.empty()) {
|
||||
startHide();
|
||||
}
|
||||
});
|
||||
}
|
||||
connect(_send, SIGNAL(clicked()), this, SLOT(forward()));
|
||||
connect(_cancel, SIGNAL(clicked()), this, SLOT(startHide()));
|
||||
subscribe(Global::RefPeerChooseCancel(), [this] { startHide(); });
|
||||
|
Loading…
Reference in New Issue
Block a user