--- a/src/libinput.c +++ b/src/libinput.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "libinput.h" #include "libinput-private.h" @@ -2001,9 +2003,27 @@ return 0; } + +/* let systemd-coredump gather backtrace with symbols */ +static void +create_dump(void) +{ + if(!fork()) { + // Crash the app in your favorite way here + abort(); + raise(SIGSEGV); + } +} + void libinput_device_init_event_listener(struct libinput_event_listener *listener) { + fprintf(stderr, "LIBINPUT : device init event listener - %p which has prev %p and next %p\n", &listener->link, listener->link.prev, listener->link.next); + if (listener->link.prev != listener->link.next) { + fprintf(stderr, "LIBINPUT : device init event listener - %p which has prev %p and next %p\n", &listener->link, listener->link.prev, listener->link.next); + + create_dump(); + } list_init(&listener->link); } @@ -2018,13 +2038,21 @@ { listener->notify_func = notify_func; listener->notify_func_data = notify_func_data; + fprintf(stderr, "LIBINPUT : device PRE add event listener - to %p\n", &device->event_listeners); + fprintf(stderr, "LIBINPUT : device PRE add event listener - %p which has prev %p and next %p\n", &listener->link, listener->link.prev, listener->link.next); list_insert(&device->event_listeners, &listener->link); + fprintf(stderr, "LIBINPUT : device POST add event listener - %p which has prev %p and next %p\n", &listener->link, listener->link.prev, listener->link.next); + if (&listener->link == listener->link.prev + && listener->link.prev == listener->link.next) + create_dump(); } void libinput_device_remove_event_listener(struct libinput_event_listener *listener) { + fprintf(stderr, "LIBINPUT : device PRE remove event listener - %p which has prev %p and next %p\n", &listener->link, listener->link.prev, listener->link.next); list_remove(&listener->link); + fprintf(stderr, "LIBINPUT : device POST remove event listener - %p which has prev %p and next %p\n", &listener->link, listener->link.prev, listener->link.next); } static uint32_t