Fix crash that can occur when changing channels (#3799)

The signal that handled the splitinput completer never disconnected, so
if it closed it would access bad memory
This commit is contained in:
pajlada
2022-06-14 15:46:52 +02:00
committed by GitHub
parent 28744810c4
commit a83c139154
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -40,9 +40,9 @@ SplitInput::SplitInput(Split *_chatWidget)
new QCompleter(&this->split_->getChannel().get()->completionModel);
this->ui_.textEdit->setCompleter(completer);
this->split_->channelChanged.connect([this] {
auto completer =
new QCompleter(&this->split_->getChannel()->completionModel);
this->signalHolder_.managedConnect(this->split_->channelChanged, [this] {
auto channel = this->split_->getChannel();
auto completer = new QCompleter(&channel->completionModel);
this->ui_.textEdit->setCompleter(completer);
});