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

Shutting down via the window X (or any other signal) doesn't allow for clean exit #117

Closed
hippietim opened this issue Jun 16, 2021 · 6 comments

Comments

@hippietim
Copy link

hippietim commented Jun 16, 2021

When the framerwork enters the Loop, it tales over signal handlers. This would be fine if it handled them by alerting the main process loop to exit. Instead it calls some cleanup code and exits from the exception thread. We've got COM initialization and objects created on the main thread that we'd like to be able to cleanup.

@ArthurSonzogni
Copy link
Owner

FTXUI insert itself as a signal handler, but does call back the previously defined signal handler at the end. So existing signal handler should continue to work without conflict with FTXUI.

I need a signal handler, in order to properly cleanup the terminal state when existing FTXUI. Goal is not to let the user with unusable terminal.

What would you like to see as API for FTXUI to help you with this?

ArthurSonzogni added a commit that referenced this issue Jun 19, 2021
When SIGINT is intercepted, quit the run loop and raise the signal
again.

I am not sure this addresses:
#117
Maybe?
ArthurSonzogni added a commit that referenced this issue Jun 19, 2021
When SIGINT is intercepted, quit the run loop and raise the signal
again.

I am not sure this addresses:
#117
Maybe?
@ArthurSonzogni
Copy link
Owner

Hey @hippietim,

I landed a few patches. Could you confirm your problem has been fixed or bring some suggestions?

@MichaelGoulding
Copy link

MichaelGoulding commented Jun 21, 2021

std::raise(0); causes an abort on Windows.

This comes from the line:
OnExit(0);
in ScreenInteractive::Loop

@MichaelGoulding
Copy link


Microsoft Visual C++ Runtime Library

Debug Assertion Failed!

Program:
File: minkernel\crts\ucrt\src\appcrt\misc\signal.cpp
Line: 456

Expression: ("Invalid signal or error", 0)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)


Abort Retry Ignore

ArthurSonzogni added a commit that referenced this issue Jun 22, 2021
A bug has been introduced in:
478d7e8

I purposefully allowed raising the signal zero, because I thought this
was doing nothing. See the response:
https://stackoverflow.com/a/32260528/5112390

but this is different on Windows.

See:
#117
ArthurSonzogni added a commit that referenced this issue Jun 22, 2021
A bug has been introduced in:
478d7e8

I purposefully allowed raising the signal zero, because I thought this
was doing nothing. See the response:
https://stackoverflow.com/a/32260528/5112390

but this is different on Windows.

See:
#117
@ArthurSonzogni
Copy link
Owner

Thanks @MichaelGoulding ! This should be fixed now.

@hippietim
Copy link
Author

The issue for us is that if we exit the process from the signal thread, we have no way of executing on the main thread again which is where we must do COM cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants