Skip to content

Commit

Permalink
Qt: Fix valgrind warning "Conditional jump or move depends on uniniti…
Browse files Browse the repository at this point in the history
…alised value"

The rust_window is initialized shortly after the constructor is
finished, but changeEvent can happen before that/

The warning can be shown in the log of #4803 (but that is not the cause of the bug)
  • Loading branch information
ogoffart committed Mar 11, 2024
1 parent b83ace4 commit b7e437f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/backends/qt/qt_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ cpp! {{
};

struct SlintWidget : QWidget {
void *rust_window;
void *rust_window = nullptr;
bool isMouseButtonDown = false;
QRect ime_position;
QString ime_text;
int ime_cursor;
int ime_anchor;
int ime_cursor = 0;
int ime_anchor = 0;

SlintWidget() {
setMouseTracking(true);
Expand Down Expand Up @@ -237,7 +237,7 @@ cpp! {{

void changeEvent(QEvent *event) override {
if (!rust_window)
return;
return QWidget::changeEvent(event);

if (event->type() == QEvent::ActivationChange) {
bool active = isActiveWindow();
Expand Down

0 comments on commit b7e437f

Please sign in to comment.