-
-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix log files unlocking when closing chat #4928
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chatterino now creates log files for all open channels, even when logging is disabled.
src/singletons/Logging.cpp
Outdated
this->loggingChannels_.at(platformName) | ||
.at(channelName) | ||
->addMessage(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels dangerous. Although all channels initialize themselves, it would be nice if this didn't throw if the platform or the channel can't be found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw should never happen, because addMessage is called only after loggingChannels_ was populated with same set of args, i would argue it failing instantly is better than hiding potential problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
taken over by @Nerixyz |
Issue
Currently log files are never unlocked, to clear logs of closed chat user needs to close chatterino.
Cause
LogginChannel
destructor is never called, because channels are currently never removed from map inLogging
singletonFix
Logging::removeChannel
method and call it whenTwitchChannel
orIrcChannel2
are destructed, which happens when last split of given channel is closedOther changes
Channel::addMessage
(frequent code path) to constructor madelogFolderName_
Channel::logFolderName()
and override it for IRC channelsLogging::addMessage
to its ownLogging::addChannel
, and call it once perChannel
instanceloggingChannels_
from map to unordered_map