Skip to content
This repository was archived by the owner on Aug 24, 2020. It is now read-only.

Conversation

fobaz
Copy link
Contributor

@fobaz fobaz commented Dec 13, 2017

Fixed cpu infinite loop when card destroyed manually, not with dragging.

Fixed cpu infinite loop when card destroyed manually, not with dragging.
@peterpeterparker
Copy link
Collaborator

Hey @fobaz

Neat, thx for the PR

Could you just give me a hints where you noticed the infinite loop (which event/method) so I could test it? I wasn't able to reproduce the problem.

Thx in advance for your support

@fobaz
Copy link
Contributor Author

fobaz commented Dec 17, 2017

Hey,

card.ts, line 26

     (function animation () {
        if (isDraging) {
            doMove();

            raf(animation);
        }
    })();`

It calls doMove(); until isDraging is false, but isDraging was not being set to false if the card is destroyed with throwOut or when manually destroyed and card.destroy() called.

Try adding 50+ cards and removing them by not dragging, but calling throwOut and then the app will be eating a lot of cpu, because the animation() function will be running for every card.

@peterpeterparker
Copy link
Collaborator

@fobaz thx for the explanation

in my test case, I always trigger panend and therefore isDraging will always be set to false

but I'm not against a little bit more of security, therefore of course I merge this PR 👍

@peterpeterparker peterpeterparker merged commit 30fdffb into fluster-app:master Dec 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants