ArthurSonzogni / FTXUI

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

Segfault when calling ScreenInteractive.PostEvent() #402

Closed ghost closed 2 years ago

ghost commented 2 years ago

If ScreenInteractive is not in a .Loop() and .PostEvent() is called it will cause a segfault:

#include "ftxui/component/event.hpp"
#include "ftxui/component/screen_interactive.hpp"

int main(void) {
  auto screen = ftxui::ScreenInteractive::TerminalOutput();
  screen.PostEvent(ftxui::Event::Custom);
}
./ftxui-starter 
Segmentation fault (core dumped)

Can this be changed so that PostEvent() does nothing when screen is not active?

ghost commented 2 years ago

Made PR to fix this here.

ArthurSonzogni commented 2 years ago

Thanks! PR merged.