Hi Johan, > Looking at how shared/io-glib.c does this (which I assume you've > verified doesn't need fixing) another (and possibly even better) > approach is to do the ref when adding the fd to the mainloop and the > unref in the destroy callback. I'll leave it up to you to choose which > one you want to go with. > I tested this approach and it doesn't fix the problem. The issue is that io_destroy immediately calls mainloop_remove_fd, which calls io_cleanup right away. This ends up reducing the reference count down to zero before the disconnect callback returns if io_destroy is called from within the callback. So we will need to have additional guards around the body of io_callback, which doesn't make the io-glib approach particularly useful. Let me know if that makes sense. -Arman -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html