lock SignalVector with shared_lock to allow reading on other threads

This commit is contained in:
fourtf
2019-07-31 22:29:07 +02:00
parent 4e4c7d4c0b
commit fff979b3c0
12 changed files with 120 additions and 35 deletions
@@ -16,7 +16,7 @@ AccountController::AccountController()
this->twitch.accounts.itemRemoved.connect([this](const auto &args) {
if (args.caller != this)
{
auto &accs = this->twitch.accounts.getVector();
auto &accs = this->twitch.accounts;
auto it = std::find(accs.begin(), accs.end(), args.item);
assert(it != accs.end());
@@ -29,7 +29,7 @@ AccountController::AccountController()
{
case ProviderId::Twitch:
{
auto &accs = this->twitch.accounts.getVector();
auto &accs = this->twitch.accounts;
auto it = std::find(accs.begin(), accs.end(), args.item);
assert(it != accs.end());
@@ -174,7 +174,7 @@ void CommandController::initialize(Settings &, Paths &paths)
auto addFirstMatchToMap = [this](auto args) {
this->commandsMap_.remove(args.item.name);
for (const Command &cmd : this->items_.getVector())
for (const Command &cmd : this->items_)
{
if (cmd.name == args.item.name)
{
@@ -185,7 +185,7 @@ void CommandController::initialize(Settings &, Paths &paths)
int maxSpaces = 0;
for (const Command &cmd : this->items_.getVector())
for (const Command &cmd : this->items_)
{
auto localMaxSpaces = cmd.name.count(' ');
if (localMaxSpaces > maxSpaces)
@@ -64,7 +64,7 @@ UserHighlightModel *HighlightController::createUserModel(QObject *parent)
bool HighlightController::isHighlightedUser(const QString &username)
{
const auto &userItems = this->highlightedUsers.getVector();
const auto &userItems = this->highlightedUsers;
for (const auto &highlightedUser : userItems)
{
if (highlightedUser.isMatch(username))
@@ -87,9 +87,7 @@ HighlightBlacklistModel *HighlightController::createBlacklistModel(
bool HighlightController::blacklistContains(const QString &username)
{
std::vector<HighlightBlacklistUser> blacklistItems =
this->blacklistedUsers.getVector();
for (const auto &blacklistedUser : blacklistItems)
for (const auto &blacklistedUser : this->blacklistedUsers)
{
if (blacklistedUser.isMatch(username))
{
+1 -1
View File
@@ -107,7 +107,7 @@ public:
if (!this->emotesChecked_)
{
const auto &accvec =
getApp()->accounts->twitch.accounts.getVector();
getApp()->accounts->twitch.accounts;
for (const auto &acc : accvec)
{
const auto &accemotes = *acc->accessEmotes();
@@ -41,7 +41,7 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
this->channelMap[Platform::Mixer].delayedItemsChanged.connect([this] { //
this->mixerSetting_.setValue(
this->channelMap[Platform::Mixer].getVector());
this->channelMap[Platform::Mixer]);
});*/
liveStatusTimer_ = new QTimer();
@@ -69,7 +69,7 @@ void NotificationController::updateChannelNotification(
bool NotificationController::isChannelNotified(const QString &channelName,
Platform p)
{
for (const auto &channel : this->channelMap[p].getVector())
for (const auto &channel : this->channelMap[p])
{
if (channelName.toLower() == channel.toLower())
{
+1 -1
View File
@@ -25,7 +25,7 @@ PingModel *PingController::createModel(QObject *parent)
bool PingController::isMuted(const QString &channelName)
{
for (const auto &channel : this->channelVector.getVector())
for (const auto &channel : this->channelVector)
{
if (channelName.toLower() == channel.toLower())
{