Fix signal connection nodiscard warnings (#4818)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "AccountController.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
|
||||
#include "controllers/accounts/Account.hpp"
|
||||
#include "controllers/accounts/AccountModel.hpp"
|
||||
@@ -10,22 +10,27 @@ namespace chatterino {
|
||||
AccountController::AccountController()
|
||||
: accounts_(SharedPtrElementLess<Account>{})
|
||||
{
|
||||
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
|
||||
this->accounts_.insert(std::dynamic_pointer_cast<Account>(args.item));
|
||||
});
|
||||
// These signal connections can safely be ignored since the twitch object
|
||||
// will always be destroyed before the AccountController
|
||||
std::ignore =
|
||||
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
|
||||
this->accounts_.insert(
|
||||
std::dynamic_pointer_cast<Account>(args.item));
|
||||
});
|
||||
|
||||
this->twitch.accounts.itemRemoved.connect([this](const auto &args) {
|
||||
if (args.caller != this)
|
||||
{
|
||||
auto &accs = this->twitch.accounts.raw();
|
||||
auto it = std::find(accs.begin(), accs.end(), args.item);
|
||||
assert(it != accs.end());
|
||||
std::ignore =
|
||||
this->twitch.accounts.itemRemoved.connect([this](const auto &args) {
|
||||
if (args.caller != this)
|
||||
{
|
||||
auto &accs = this->twitch.accounts.raw();
|
||||
auto it = std::find(accs.begin(), accs.end(), args.item);
|
||||
assert(it != accs.end());
|
||||
|
||||
this->accounts_.removeAt(it - accs.begin(), this);
|
||||
}
|
||||
});
|
||||
this->accounts_.removeAt(it - accs.begin(), this);
|
||||
}
|
||||
});
|
||||
|
||||
this->accounts_.itemRemoved.connect([this](const auto &args) {
|
||||
std::ignore = this->accounts_.itemRemoved.connect([this](const auto &args) {
|
||||
switch (args.item->getProviderId())
|
||||
{
|
||||
case ProviderId::Twitch: {
|
||||
|
||||
@@ -587,8 +587,10 @@ void CommandController::initialize(Settings &, Paths &paths)
|
||||
|
||||
this->maxSpaces_ = maxSpaces;
|
||||
};
|
||||
this->items.itemInserted.connect(addFirstMatchToMap);
|
||||
this->items.itemRemoved.connect(addFirstMatchToMap);
|
||||
// We can safely ignore these signal connections since items will be destroyed
|
||||
// before CommandController
|
||||
std::ignore = this->items.itemInserted.connect(addFirstMatchToMap);
|
||||
std::ignore = this->items.itemRemoved.connect(addFirstMatchToMap);
|
||||
|
||||
// Initialize setting manager for commands.json
|
||||
auto path = combinePath(paths.settingsDirectory, "commands.json");
|
||||
@@ -604,7 +606,7 @@ void CommandController::initialize(Settings &, Paths &paths)
|
||||
|
||||
// Update the setting when the vector of commands has been updated (most
|
||||
// likely from the settings dialog)
|
||||
this->items.delayedItemsChanged.connect([this] {
|
||||
std::ignore = this->items.delayedItemsChanged.connect([this] {
|
||||
this->commandsSetting_->setValue(this->items.raw());
|
||||
});
|
||||
|
||||
|
||||
@@ -36,9 +36,13 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||
this->channelMap[Platform::Twitch].append(channelName);
|
||||
}
|
||||
|
||||
this->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] {
|
||||
this->twitchSetting_.setValue(this->channelMap[Platform::Twitch].raw());
|
||||
});
|
||||
// We can safely ignore this signal connection since channelMap will always be destroyed
|
||||
// before the NotificationController
|
||||
std::ignore =
|
||||
this->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] {
|
||||
this->twitchSetting_.setValue(
|
||||
this->channelMap[Platform::Twitch].raw());
|
||||
});
|
||||
|
||||
liveStatusTimer_ = new QTimer();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user