# HG changeset patch # User Sadrul Habib Chowdhury # Date 1177309698 0 # Node ID 94843d812e69be216abe91daa2b76a0a0dff79b7 # Parent 2195e8f2518de98037a561635552633b19cb2517 Gracefully do nothing if the WINDOWID is invalid. And plug a leak, thanks to deryni. diff -r 2195e8f2518d -r 94843d812e69 finch/plugins/gntgf.c --- a/finch/plugins/gntgf.c Sun Apr 22 23:56:41 2007 +0000 +++ b/finch/plugins/gntgf.c Mon Apr 23 06:28:18 2007 +0000 @@ -111,6 +111,15 @@ } #ifdef HAVE_X11 +static int +error_handler(Display *dpy, XErrorEvent *error) +{ + char buffer[1024]; + XGetErrorText(dpy, error->error_code, buffer, sizeof(buffer)); + purple_debug_error("gntgf", "Could not set urgent to the window: %s.\n", buffer); + return 0; +} + static void urgent() { @@ -130,9 +139,14 @@ if (dpy == NULL) return; + XSetErrorHandler(error_handler); hints = XGetWMHints(dpy, id); - hints->flags|=XUrgencyHint; - XSetWMHints(dpy, id, hints); + if (hints) { + hints->flags|=XUrgencyHint; + XSetWMHints(dpy, id, hints); + XFree(hints); + } + XSetErrorHandler(NULL); XFlush(dpy); XCloseDisplay(dpy);