mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix crash resulting from a mutex deadlock when switching users (#4675)
This commit is contained in:
parent
335dff53af
commit
65a14fb95b
|
@ -7,6 +7,7 @@
|
|||
- Minor: Added `/shoutout <username>` commands to shoutout specified user. (#4638)
|
||||
- Minor: Improved editing hotkeys. (#4628)
|
||||
- Bugfix: Fixed generation of crashdumps by the browser-extension process when the browser was closed. (#4667)
|
||||
- Bugfix: Fixed a crash when opening and closing a reply thread and switching the user. (#4675)
|
||||
- Dev: Added command to set Qt's logging filter/rules at runtime (`/c2-set-logging-rules`). (#4637)
|
||||
- Dev: Added the ability to see & load custom themes from the Themes directory. No stable promises are made of this feature, changes might be made that breaks custom themes without notice. (#4570)
|
||||
- Dev: Added test cases for emote and tab completion. (#4644)
|
||||
|
|
|
@ -138,26 +138,25 @@ void ReplyThreadPopup::addMessagesFromThread()
|
|||
this->setWindowTitle(TEXT_TITLE.arg(this->thread_->root()->loginName,
|
||||
sourceChannel->getName()));
|
||||
|
||||
ChannelPtr virtualChannel;
|
||||
if (sourceChannel->isTwitchChannel())
|
||||
{
|
||||
virtualChannel =
|
||||
this->virtualChannel_ =
|
||||
std::make_shared<TwitchChannel>(sourceChannel->getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
virtualChannel = std::make_shared<Channel>(sourceChannel->getName(),
|
||||
Channel::Type::None);
|
||||
this->virtualChannel_ = std::make_shared<Channel>(
|
||||
sourceChannel->getName(), Channel::Type::None);
|
||||
}
|
||||
|
||||
this->ui_.threadView->setChannel(virtualChannel);
|
||||
this->ui_.threadView->setChannel(this->virtualChannel_);
|
||||
this->ui_.threadView->setSourceChannel(sourceChannel);
|
||||
|
||||
auto overrideFlags =
|
||||
boost::optional<MessageFlags>(this->thread_->root()->flags);
|
||||
overrideFlags->set(MessageFlag::DoNotLog);
|
||||
|
||||
virtualChannel->addMessage(this->thread_->root(), overrideFlags);
|
||||
this->virtualChannel_->addMessage(this->thread_->root(), overrideFlags);
|
||||
for (const auto &msgRef : this->thread_->replies())
|
||||
{
|
||||
if (auto msg = msgRef.lock())
|
||||
|
@ -165,24 +164,24 @@ void ReplyThreadPopup::addMessagesFromThread()
|
|||
auto overrideFlags = boost::optional<MessageFlags>(msg->flags);
|
||||
overrideFlags->set(MessageFlag::DoNotLog);
|
||||
|
||||
virtualChannel->addMessage(msg, overrideFlags);
|
||||
this->virtualChannel_->addMessage(msg, overrideFlags);
|
||||
}
|
||||
}
|
||||
|
||||
this->messageConnection_ =
|
||||
std::make_unique<pajlada::Signals::ScopedConnection>(
|
||||
sourceChannel->messageAppended.connect(
|
||||
[this, virtualChannel](MessagePtr &message, auto) {
|
||||
if (message->replyThread == this->thread_)
|
||||
{
|
||||
auto overrideFlags =
|
||||
boost::optional<MessageFlags>(message->flags);
|
||||
overrideFlags->set(MessageFlag::DoNotLog);
|
||||
sourceChannel->messageAppended.connect([this](MessagePtr &message,
|
||||
auto) {
|
||||
if (message->replyThread == this->thread_)
|
||||
{
|
||||
auto overrideFlags =
|
||||
boost::optional<MessageFlags>(message->flags);
|
||||
overrideFlags->set(MessageFlag::DoNotLog);
|
||||
|
||||
// same reply thread, add message
|
||||
virtualChannel->addMessage(message, overrideFlags);
|
||||
}
|
||||
}));
|
||||
// same reply thread, add message
|
||||
this->virtualChannel_->addMessage(message, overrideFlags);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void ReplyThreadPopup::updateInputUI()
|
||||
|
|
|
@ -34,6 +34,8 @@ private:
|
|||
std::shared_ptr<MessageThread> thread_;
|
||||
// The channel that the reply thread is in
|
||||
ChannelPtr channel_;
|
||||
// The channel for the `threadView`
|
||||
ChannelPtr virtualChannel_;
|
||||
Split *split_;
|
||||
|
||||
struct {
|
||||
|
|
Loading…
Reference in a new issue