Closed Julien2313 closed 3 years ago
Hi @Julien2313 - you can't use Close()
inside event handlers, as it closes the event channels.
Cancel()
should be fine but I can see that there's a bug when Cancel()
is called multiple times before it's handled (it just sends a message to a channel).
I'll have a look if Cancel()
can be fixed.
What you can do for now is make sure you only send cancel once (e.g. by setting a flag the first time you call Cancel()
and then not call it after that flag is set to true.
as for Close()
- that should only be used after ParseToEnd()
or ParseFrame()
has returned and nothing is currently processing.
Oooh ok ok, that's why ! Thank you for your fast answer :) Yeah, I put in the example Close() but I'm testing it with Cancel() (as your comment says)
I'll add a flag, thank you :)
Finally got around to this now.
@Julien2313 - would you be able to test my fix in this PR? https://github.com/markus-wa/demoinfocs-golang/pull/278
It doesn't panic anymore, but it doesn't look like either to cancel the parsing :(
This was actually expected behaviour up until now (any parsed events would still be sent on). But after this change we don't need to do this anymore, so I've adjusted that as well.
Could you try again to see if it works with the latest commit on that PR?
Working fine now ! :)
Thanks for the quick test @Julien2313 !
I've released v2.7.0 with the fix
Hello :) While parsing a demo, if a use the function Cancel() or Close(), the parser panics with a deadlock error
Code:
Expected behavior No deadlock
Additional context I have no idea if I'm using correctly Close or Cancel ?