Wayland: fix memory leak on FL_KEYUP events

The old code would allocate memory on FL_KEYDOWN and FL_KEYUP events
and never free the latter.

The fix is to allocate memory only on FL_KEYDOWN events which will
be free'd later as intended.

Also fix two unrelated whitespace errors.
This commit is contained in:
Albrecht Schlosser 2022-09-06 20:04:33 +02:00
parent 57e0cdec08
commit deeb977c2e

View File

@ -711,11 +711,12 @@ fprintf(stderr, "key %s: sym: %-12s(%d) code:%u fl_win=%p, ", action, buf, sym,
Fl::e_is_click = 0;
Fl::handle(event, win);
}
key_repeat_data_t *key_repeat_data = new key_repeat_data_t;
key_repeat_data->time = time;
key_repeat_data->window = win;
if (event == FL_KEYDOWN && status == XKB_COMPOSE_NOTHING && !(sym >= FL_Shift_L && sym <= FL_Alt_R))
if (event == FL_KEYDOWN && status == XKB_COMPOSE_NOTHING && !(sym >= FL_Shift_L && sym <= FL_Alt_R)) {
key_repeat_data_t *key_repeat_data = new key_repeat_data_t;
key_repeat_data->time = time;
key_repeat_data->window = win;
Fl::add_timeout(KEY_REPEAT_DELAY, (Fl_Timeout_Handler)key_repeat_timer_cb, key_repeat_data);
}
}
static void wl_keyboard_leave(void *data, struct wl_keyboard *wl_keyboard,