Skip to content

Commit

Permalink
fix: invalidate channel view buffers when assigning paint
Browse files Browse the repository at this point in the history
Regarding #259
  • Loading branch information
Nerixyz committed Jan 24, 2024
1 parent eddc8aa commit 27d1b1a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/providers/seventv/SeventvPaints.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "providers/seventv/SeventvPaints.hpp"

#include "Application.hpp"
#include "common/network/NetworkRequest.hpp"
#include "common/network/NetworkResult.hpp"
#include "common/Outcome.hpp"
Expand All @@ -8,6 +9,8 @@
#include "providers/seventv/paints/PaintDropShadow.hpp"
#include "providers/seventv/paints/RadialGradientPaint.hpp"
#include "providers/seventv/paints/UrlPaint.hpp"
#include "singletons/WindowManager.hpp"
#include "util/PostToThread.hpp"

#include <QUrlQuery>

Expand Down Expand Up @@ -174,7 +177,25 @@ void SeventvPaints::assignPaintToUser(const QString &paintID,
const auto paintIt = this->knownPaints_.find(paintID);
if (paintIt != this->knownPaints_.end())
{
this->paintMap_[userName.string] = paintIt->second;
auto it = this->paintMap_.find(userName.string);
bool changed = false;
if (it == this->paintMap_.end())
{
this->paintMap_.emplace(userName.string, paintIt->second);
changed = true;
}
else if (it->second != paintIt->second)
{
it->second = paintIt->second;
changed = true;
}

if (changed)
{
postToThread([] {
getIApp()->getWindows()->invalidateChannelViewBuffers();
});
}
}
}

Expand Down

0 comments on commit 27d1b1a

Please sign in to comment.