File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -362,31 +362,34 @@ void Engine::stop()
362
362
// https://github.com/scratchfoundation/scratch-vm/blob/f1aa92fad79af17d9dd1c41eeeadca099339a9f1/src/engine/runtime.js#L2057-L2081
363
363
if (m_activeThread) {
364
364
stopThread (m_activeThread.get ());
365
- // NOTE: The project should continue running even after "stop all" is called and the remaining threads should be stepped once.
366
- // The remaining threads can even start new threads which will ignore the "stop all" call and will "restart" the project.
367
- // This is probably a bug in the Scratch VM, but let's keep it here to keep it compatible.
368
- m_threadsToStop = m_threads;
369
365
370
366
// Remove threads owned by clones because clones are going to be deleted (#547)
371
367
m_threads.erase (
372
368
std::remove_if (
373
369
m_threads.begin (),
374
370
m_threads.end (),
375
- [](std::shared_ptr<Thread> thread) {
371
+ [this ](std::shared_ptr<Thread> thread) {
376
372
assert (thread);
377
373
Target *target = thread->target ();
378
374
assert (target);
379
375
380
376
if (!target->isStage ()) {
381
377
Sprite *sprite = static_cast <Sprite *>(target);
382
378
383
- if (sprite->isClone ())
379
+ if (sprite->isClone ()) {
380
+ m_threadAboutToStop (thread.get ());
384
381
return true ;
382
+ }
385
383
}
386
384
387
385
return false ;
388
386
}),
389
387
m_threads.end ());
388
+
389
+ // NOTE: The project should continue running even after "stop all" is called and the remaining threads should be stepped once.
390
+ // The remaining threads can even start new threads which will ignore the "stop all" call and will "restart" the project.
391
+ // This is probably a bug in the Scratch VM, but let's keep it here to keep it compatible.
392
+ m_threadsToStop = m_threads;
390
393
} else {
391
394
// If there isn't any active thread, it means the project was stopped from the outside
392
395
// In this case all threads should be removed and the project should be considered stopped
You can’t perform that action at this time.
0 commit comments