aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/x11/backend.c2
-rw-r--r--examples/idle.c1
-rw-r--r--examples/multi-pointer.c19
-rw-r--r--examples/output-layout.c12
-rw-r--r--examples/pointer.c10
-rw-r--r--examples/rotation.c10
-rw-r--r--examples/simple.c10
-rw-r--r--examples/tablet.c10
-rw-r--r--examples/touch.c10
-rw-r--r--types/tablet_v2/wlr_tablet_v2.c15
10 files changed, 75 insertions, 24 deletions
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index e0f5d6e7..0ff2925d 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -163,6 +163,8 @@ static bool backend_start(struct wlr_backend *backend) {
0,
0,
0);
+
+ free(reply);
}
}
#endif
diff --git a/examples/idle.c b/examples/idle.c
index 87a03924..3e1565ca 100644
--- a/examples/idle.c
+++ b/examples/idle.c
@@ -129,6 +129,7 @@ int main(int argc, char *argv[]) {
wl_registry_add_listener(registry, &registry_listener, NULL);
wl_display_dispatch(display);
wl_display_roundtrip(display);
+ free(registry);
if (idle_manager == NULL) {
fprintf(stderr, "display doesn't support idle protocol\n");
diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c
index 958e90f6..49670c39 100644
--- a/examples/multi-pointer.c
+++ b/examples/multi-pointer.c
@@ -239,15 +239,21 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
case WLR_INPUT_DEVICE_POINTER:;
- struct sample_cursor *cursor = calloc(1, sizeof(struct sample_cursor));
+ struct sample_cursor *cursor = calloc(1, sizeof(struct sample_cursor));
struct sample_pointer *pointer = calloc(1, sizeof(struct sample_pointer));
pointer->device = device;
- cursor->sample = sample;
+ cursor->sample = sample;
cursor->device = device;
cursor->cursor = wlr_cursor_create();
@@ -324,6 +330,11 @@ int main(int argc, char *argv[]) {
cursor_destroy(cursor);
}
+ struct sample_pointer *pointer, *tmp_pointer;
+ wl_list_for_each_safe(pointer, tmp_pointer, &state.pointers, link) {
+ free(pointer);
+ }
+
wlr_xcursor_theme_destroy(theme);
wlr_output_layout_destroy(state.layout);
}
diff --git a/examples/output-layout.c b/examples/output-layout.c
index 2bfc5923..2d1bc58b 100644
--- a/examples/output-layout.c
+++ b/examples/output-layout.c
@@ -239,8 +239,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
default:
@@ -285,6 +291,6 @@ int main(int argc, char *argv[]) {
wlr_texture_destroy(state.cat_texture);
- wlr_output_layout_destroy(state.layout);
wl_display_destroy(state.display);
+ wlr_output_layout_destroy(state.layout);
}
diff --git a/examples/pointer.c b/examples/pointer.c
index f0d9fb4b..cc58c223 100644
--- a/examples/pointer.c
+++ b/examples/pointer.c
@@ -304,8 +304,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
default:
diff --git a/examples/rotation.c b/examples/rotation.c
index add7f42f..7cf5727b 100644
--- a/examples/rotation.c
+++ b/examples/rotation.c
@@ -188,8 +188,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
default:
diff --git a/examples/simple.c b/examples/simple.c
index 1125bd2a..e1c10906 100644
--- a/examples/simple.c
+++ b/examples/simple.c
@@ -141,8 +141,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
default:
diff --git a/examples/tablet.c b/examples/tablet.c
index 4817db4d..fad30d52 100644
--- a/examples/tablet.c
+++ b/examples/tablet.c
@@ -297,8 +297,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
case WLR_INPUT_DEVICE_TABLET_PAD:;
diff --git a/examples/touch.c b/examples/touch.c
index ba5d1e34..9ed20a28 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -210,8 +210,14 @@ void new_input_notify(struct wl_listener *listener, void *data) {
wlr_log(WLR_ERROR, "Failed to create XKB context");
exit(1);
}
- wlr_keyboard_set_keymap(device->keyboard, xkb_map_new_from_names(context,
- &rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
+ struct xkb_keymap *keymap = xkb_map_new_from_names(context, &rules,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap) {
+ wlr_log(WLR_ERROR, "Failed to create XKB keymap");
+ exit(1);
+ }
+ wlr_keyboard_set_keymap(device->keyboard, keymap);
+ xkb_keymap_unref(keymap);
xkb_context_unref(context);
break;
case WLR_INPUT_DEVICE_TOUCH:;
diff --git a/types/tablet_v2/wlr_tablet_v2.c b/types/tablet_v2/wlr_tablet_v2.c
index c0e815ed..7f3d5f30 100644
--- a/types/tablet_v2/wlr_tablet_v2.c
+++ b/types/tablet_v2/wlr_tablet_v2.c
@@ -283,6 +283,7 @@ void wlr_tablet_v2_destroy(struct wlr_tablet_manager_v2 *manager) {
}
wlr_signal_emit_safe(&manager->events.destroy, manager);
+ wl_list_remove(&manager->display_destroy.link);
wl_global_destroy(manager->wl_global);
free(manager);
}
@@ -294,13 +295,6 @@ struct wlr_tablet_manager_v2 *wlr_tablet_v2_create(struct wl_display *display) {
return NULL;
}
- wl_signal_init(&tablet->events.destroy);
- wl_list_init(&tablet->clients);
- wl_list_init(&tablet->seats);
-
- tablet->display_destroy.notify = handle_display_destroy;
- wl_display_add_destroy_listener(display, &tablet->display_destroy);
-
tablet->wl_global = wl_global_create(display,
&zwp_tablet_manager_v2_interface, TABLET_MANAGER_VERSION,
tablet, tablet_v2_bind);
@@ -309,5 +303,12 @@ struct wlr_tablet_manager_v2 *wlr_tablet_v2_create(struct wl_display *display) {
return NULL;
}
+ wl_signal_init(&tablet->events.destroy);
+ wl_list_init(&tablet->clients);
+ wl_list_init(&tablet->seats);
+
+ tablet->display_destroy.notify = handle_display_destroy;
+ wl_display_add_destroy_listener(display, &tablet->display_destroy);
+
return tablet;
}