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: {
|
||||
|
||||
Reference in New Issue
Block a user