Replies: 1 comment
-
See github issue #132 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi - I'm using cli and really like it. It's going to save me huge amounts of time. I'm working on a tool that presents a cli on different threads at different times in a multi-threaded application. There's a segfault bug in linuxkeyboard.h when doing this. It has to do with the detached thread reading keyboard input (i.e. std::getchar) which is still alive after tearing down the session (it's blocking in getchar). The next time the user presses a key the detached thread returns from getchar (in Read()) but the reference to the scheduler is now invalid and the call to Post crashes with a segfault because the vtable is gone.
I got it to quit crashing by having LinuxKeyboard check the "run" boolean member variable before calling notify. It still eats the first key stroke that would have gone to a new local session instance, which is annoying but it's better than crashing. I'm using the LoopScheduler and calling Stop() in my ExitAction. I'm open to the idea that I'm tearing things down improperly, but I really think it's an artifact of the detached thread being stuck in a blocking call to getchar() when the session is torn down.
Beta Was this translation helpful? Give feedback.
All reactions