Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when calling Screen.Fini() while suspended #440

Closed
rivo opened this issue Mar 11, 2021 · 3 comments
Closed

Panic when calling Screen.Fini() while suspended #440

rivo opened this issue Mar 11, 2021 · 3 comments

Comments

@rivo
Copy link
Contributor

rivo commented Mar 11, 2021

First of all, thanks for implementing #194!

I'd like to be able to stop the application after having called Screen.Suspend(), i.e. while the screen is suspended. Currently, calling Screen.Fini() results in a panic:

panic: close of nil channel
github.com/gdamore/tcell/v2.(*tScreen).disengage(0xc000182000)
        /usr/local/var/go/pkg/mod/github.com/gdamore/tcell/v2@v2.2.0/tscreen_unix.go:66 +0x87
github.com/gdamore/tcell/v2.(*tScreen).finalize(...)
        /usr/local/var/go/pkg/mod/github.com/gdamore/tcell/v2@v2.2.0/tscreen_unix.go:111
github.com/gdamore/tcell/v2.(*tScreen).finish(...)
        /usr/local/var/go/pkg/mod/github.com/gdamore/tcell/v2@v2.2.0/tscreen.go:478
sync.(*Once).doSlow(0xc0001821b4, 0xc00017bc30)
        /usr/local/Cellar/go/1.15/libexec/src/sync/once.go:66 +0xec
sync.(*Once).Do(...)
        /usr/local/Cellar/go/1.15/libexec/src/sync/once.go:57
github.com/gdamore/tcell/v2.(*tScreen).Fini(0xc000182000)
        /usr/local/var/go/pkg/mod/github.com/gdamore/tcell/v2@v2.2.0/tscreen.go:473 +0x6a

Would it be possible for you to allow calling Fini() after Suspend() (without having to call Resume() first)?

@gdamore
Copy link
Owner

gdamore commented Mar 12, 2021

Yes, I don't see any reason we should not allow that. Its strictly an oversight that this was missed.

@gdamore gdamore added the bug label Mar 12, 2021
@gdamore
Copy link
Owner

gdamore commented May 16, 2021

I believe this should be fixed now as a consequence of fixing #460. disengage is now idempotent.

@rivo
Copy link
Contributor Author

rivo commented May 20, 2021

Thanks!

@rivo rivo closed this as completed May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants