From faab25c25cd9cf1b76962e9cb8b26c2c754c0cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 25 Jun 2014 00:06:58 +0200 Subject: Make context reference counted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of only allowing one owner keeping a libinput context alive, make context reference counted, replacing libinput_destroy() with libinput_unref() while adding another function libinput_ref(). Even though there might not be any current use cases, it doesn't mean we should hard code this usage model in the API. The old behaviour can be emulated by never calling libinput_ref() while replacing libinput_destroy() with libinput_unref(). Signed-off-by: Jonas Ã…dahl Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- tools/event-debug.c | 4 ++-- tools/event-gui.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/event-debug.c b/tools/event-debug.c index 34acfce2..95e76286 100644 --- a/tools/event-debug.c +++ b/tools/event-debug.c @@ -163,7 +163,7 @@ open_device(struct libinput **li, const char *path) device = libinput_path_add_device(*li, path); if (!device) { fprintf(stderr, "Failed to initialized device %s\n", path); - libinput_destroy(*li); + libinput_unref(*li); return 1; } @@ -478,7 +478,7 @@ main(int argc, char **argv) mainloop(li); - libinput_destroy(li); + libinput_unref(li); if (udev) udev_unref(udev); diff --git a/tools/event-gui.c b/tools/event-gui.c index 95540936..9c39c213 100644 --- a/tools/event-gui.c +++ b/tools/event-gui.c @@ -467,7 +467,7 @@ main(int argc, char *argv[]) gtk_main(); - libinput_destroy(li); + libinput_unref(li); udev_unref(udev); return 0; -- cgit v1.2.1