Mercurial > pidgin.yaz
changeset 16320:94843d812e69
Gracefully do nothing if the WINDOWID is invalid. And plug a leak, thanks to deryni.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 23 Apr 2007 06:28:18 +0000 |
parents | 2195e8f2518d |
children | 3ba37836d674 |
files | finch/plugins/gntgf.c |
diffstat | 1 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);