Fix PostEvent() segfault (#403)

Fix segfault when PostEvent() called on inactive screen.

Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
Conner
2022-05-22 08:37:27 -05:00
committed by GitHub
parent c033ca61ae
commit f9256fa132
2 changed files with 21 additions and 3 deletions

View File

@@ -47,6 +47,20 @@ TEST(ScreenInteractive, Signal_SIGFPE) {
TestSignal(SIGFPE);
}
// Regression test for:
// https://github.com/ArthurSonzogni/FTXUI/issues/402
TEST(ScreenInteractive, PostEventToNonActive) {
auto screen = ScreenInteractive::FitComponent();
screen.Post(Event::Custom);
}
// Regression test for:
// https://github.com/ArthurSonzogni/FTXUI/issues/402
TEST(ScreenInteractive, PostTaskToNonActive) {
auto screen = ScreenInteractive::FitComponent();
screen.Post([] {});
}
} // namespace ftxui
// Copyright 2021 Arthur Sonzogni. All rights reserved.