Fix crash when closing and quickly opening a split, then running /clearmessages (#3852)

This commit is contained in:
Daniel Sage 2022-07-10 09:08:20 -04:00 committed by GitHub
parent e1b512a373
commit 965b06677a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -23,6 +23,7 @@
- Minor: Added `/copy` command. Usage: `/copy <text>`. Copies provided text to clipboard - can be useful with custom commands. (#3763) - Minor: Added `/copy` command. Usage: `/copy <text>`. Copies provided text to clipboard - can be useful with custom commands. (#3763)
- Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792) - Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792)
- Minor: Add Quick Switcher item to open a channel in a new popup window. (#3828) - Minor: Add Quick Switcher item to open a channel in a new popup window. (#3828)
- Bugfix: Fix crash that can occur when closing and quickly reopening a split, then running a command. (#3852)
- Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716) - Bugfix: Connection to Twitch PubSub now recovers more reliably. (#3643, #3716)
- Bugfix: Fix crash that can occur when changing channels. (#3799) - Bugfix: Fix crash that can occur when changing channels. (#3799)
- Bugfix: Fixed viewers list search not working when used before loading finishes. (#3774) - Bugfix: Fixed viewers list search not working when used before loading finishes. (#3774)

View file

@ -932,7 +932,11 @@ void CommandController::initialize(Settings &, Paths &paths)
auto *currentPage = dynamic_cast<SplitContainer *>( auto *currentPage = dynamic_cast<SplitContainer *>(
getApp()->windows->getMainWindow().getNotebook().getSelectedPage()); getApp()->windows->getMainWindow().getNotebook().getSelectedPage());
currentPage->getSelectedSplit()->getChannelView().clearMessages(); if (auto split = currentPage->getSelectedSplit())
{
split->getChannelView().clearMessages();
}
return ""; return "";
}); });

View file

@ -408,12 +408,13 @@ void Window::addShortcuts()
{ {
splitContainer = this->notebook_->getOrAddSelectedPage(); splitContainer = this->notebook_->getOrAddSelectedPage();
} }
this->notebook_->select(splitContainer);
Split *split = new Split(splitContainer); Split *split = new Split(splitContainer);
split->setChannel( split->setChannel(
getApp()->twitch->getOrAddChannel(si.channelName)); getApp()->twitch->getOrAddChannel(si.channelName));
split->setFilters(si.filters); split->setFilters(si.filters);
splitContainer->appendSplit(split); splitContainer->appendSplit(split);
splitContainer->setSelected(split);
this->notebook_->select(splitContainer);
return ""; return "";
}}, }},
{"toggleLocalR9K", {"toggleLocalR9K",