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

Screen::Cursor::shape is uninitialized when used #986

Open
dylanhart opened this issue Jan 9, 2025 · 1 comment
Open

Screen::Cursor::shape is uninitialized when used #986

dylanhart opened this issue Jan 9, 2025 · 1 comment

Comments

@dylanhart
Copy link

  • Screen::cursor_ is created using the default constructor of Screen::Cursor
  • Screen::Cursor::shape is not set in the default constructor
  • shape is later used without being set in places like ScreenInteractive::Draw(Component)

This has caused crashes and other weird behavior in some of my builds.

Related issues: #937 #602


Possible fix:

@@ -105,7 +105,7 @@ class Screen {
       BarBlinking = 5,
       Bar = 6,
     };
-    Shape shape;
+    Shape shape = Shape::Hidden;
   };
   Cursor cursor() const { return cursor_; }
   void SetCursor(Cursor cursor) { cursor_ = cursor; }
@tobywenman
Copy link

Hey, I just bumped into this too, it was generating a bunch of Valgrind warnings in one of my projects.

Turns out that cmake has a feature to apply patches to fetchContent which works pretty well for me. Your fix works just fine.

project(ftxui-patch)

set(ftxui-patch git apply ${CMAKE_CURRENT_SOURCE_DIR}/patches/ftxui-cursorShape.patch)

include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui
  GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
  GIT_TAG v5.0.0
  PATCH_COMMAND ${ftxui-patch}
)
FetchContent_MakeAvailable(ftxui)

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

2 participants