summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2014-06-25 00:06:58 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2014-06-25 10:27:03 +1000
commitfaab25c25cd9cf1b76962e9cb8b26c2c754c0cde (patch)
tree5cbafa0b852e86d726bddd482b08a612ef99174e /tools
parent13e9a1d7449d3b5db1dc7d9cf3aa6187911ee08c (diff)
downloadlibinput-faab25c25cd9cf1b76962e9cb8b26c2c754c0cde.tar.gz
Make context reference counted
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 <jadahl@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/event-debug.c4
-rw-r--r--tools/event-gui.c2
2 files changed, 3 insertions, 3 deletions
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;