Content-Length: 317828 | pFad | http://github.com/benkuper/Chataigne/commit/ec38d0ad4a966b4fb5c7a1d9004fce19ca32fbf2

13 fix ConsequenceManager looped stagger launch crash · benkuper/Chataigne@ec38d0a · GitHub
Skip to content

Commit

Permalink
fix ConsequenceManager looped stagger launch crash
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Jan 2, 2025
1 parent 722b8cb commit ec38d0a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/ChataigneEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ChataigneEngine::~ChataigneEngine()
MouseHooker::deleteInstance();
#endif

ConsequenceStaggerLauncher::deleteInstance();

ZeroconfManager::deleteInstance();
CommunityModuleManager::deleteInstance();
Expand All @@ -104,7 +105,6 @@ ChataigneEngine::~ChataigneEngine()
InputSystemManager::deleteInstance();
StreamDeckManager::deleteInstance();

ConsequenceStaggerLauncher::deleteInstance();

ChataigneAssetManager::deleteInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,28 @@ ConsequenceStaggerLauncher::~ConsequenceStaggerLauncher()

void ConsequenceStaggerLauncher::run()
{
Array<Launch*> toRemove;
toRemove.clear();

while (!threadShouldExit())
{

{
GenericScopedLock lock(launches.getLock());
for (auto& l : launches)
{
processLaunch(l);
if (l->isFinished()) toRemove.add(l);
}
}

{
GenericScopedLock lock(toRemove.getLock());
for (auto& l : toRemove) launches.removeObject(l);

if (launches.isEmpty()) break;
toRemove.clear();
}

if (launches.isEmpty()) break;

wait(10);
}

Expand Down Expand Up @@ -254,14 +259,11 @@ void ConsequenceStaggerLauncher::addLaunch(ConsequenceManager* csm, int multiple

void ConsequenceStaggerLauncher::removeLaunchesFor(ConsequenceManager* manager, int multiplexIndex)
{
GenericScopedLock lock(launches.getLock());
Array<Launch*> toRemove;
GenericScopedLock lock(toRemove.getLock());
for (auto& l : launches)
{
if (l->manager == manager && (multiplexIndex == -1 || l->multiplexIndex == multiplexIndex)) toRemove.add(l);
}

for (auto& l : toRemove) launches.removeObject(l);
}

void ConsequenceManager::multiplexPreviewIndexChanged()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,26 @@ class ConsequenceStaggerLauncher :
public:
juce_DeclareSingleton(ConsequenceStaggerLauncher, false)

ConsequenceStaggerLauncher();
ConsequenceStaggerLauncher();
~ConsequenceStaggerLauncher();


struct Launch
{
Launch(ConsequenceManager* c, int multiplexIndex) : manager(c), startTime(Time::getMillisecondCounter()), multiplexIndex(multiplexIndex), triggerIndex(0) {}


ConsequenceManager* manager;
uint32 startTime;
int multiplexIndex;
int triggerIndex;
Launch* currentProcessingLaunch;

bool isFinished();
};

OwnedArray<Launch, juce::CriticalSection> launches;
Array<Launch*, juce::CriticalSection> toRemove;

void run() override;
void processLaunch(Launch* l);
Expand Down

0 comments on commit ec38d0a

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/benkuper/Chataigne/commit/ec38d0ad4a966b4fb5c7a1d9004fce19ca32fbf2

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy