ArthurSonzogni / FTXUI

:computer: C++ Functional Terminal User Interface. :heart:
MIT License
6.94k stars 418 forks source link

Problem: Linux terminal app stops working after resizing #517

Closed mr-mocap closed 1 year ago

mr-mocap commented 1 year ago

Summary: Start up an FTXUI app and then begin resizing. You will quickly see that the terminal stops updating. In fact, the entire UI is now non-responsive.

One Possible Reason: First of all, only have a single thread in your program. Second, it looks like a SIGWINCH can occur while the Receiver class is holding a lock on the mutex. If this happens, the OnResize() code tries to then Send() an Event, which ends up trying to acquire a lock on the same mutex (The original lock is still held during the signal). The process can then end up in the condition_variable's wait()... waiting on the same thread to unlock that other mutex (which, of course, it cannot).

I've already found and implemented a solution for this, which is a rather small change.

ArthurSonzogni commented 1 year ago

Thanks for reporting this! Yes, this sounds like a valid problem.

Happy to wait for your fix if you have one ;-)

forworldm commented 1 year ago

you may replace signal with signalfd

mr-mocap commented 1 year ago

I thought about that. I wanted something closer to what already exists. We can always improve!

I can look into it tonight.

ArthurSonzogni commented 1 year ago

This has been fixed.