pidgin.vv: 9f5fc8e9: Implement an X error handler to prevent ...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Mon Feb 2 06:40:29 EST 2009
-----------------------------------------------------------------
Revision: 9f5fc8e9e2a37e98d2ee9cda84783f664fb34040
Ancestor: 9de7de36be0d4c31be515e3b12179a5d51423e0d
Author: maiku at soc.pidgin.im
Date: 2009-02-02T10:24:55
Branch: im.pidgin.pidgin.vv
URL: http://d.pidgin.im/viewmtn/revision/info/9f5fc8e9e2a37e98d2ee9cda84783f664fb34040
Modified files:
pidgin/gtkmedia.c
ChangeLog:
Implement an X error handler to prevent Pidgin from crashing on
BadWindow and related errors.
-------------- next part --------------
============================================================
--- pidgin/gtkmedia.c 84e179d9e754b39e7ac4cdd58ac9b2d24a9ccb8a
+++ pidgin/gtkmedia.c 3cb419ccde59e2a1d5af963c00f104d0ade10517
@@ -184,12 +184,48 @@ pidgin_media_delete_event_cb(GtkWidget *
return FALSE;
}
+static int
+pidgin_x_error_handler(Display *display, XErrorEvent *event)
+{
+ const gchar *error_type;
+ switch (event->error_code) {
+#define XERRORCASE(type) case type: error_type = #type; break
+ XERRORCASE(BadAccess);
+ XERRORCASE(BadAlloc);
+ XERRORCASE(BadAtom);
+ XERRORCASE(BadColor);
+ XERRORCASE(BadCursor);
+ XERRORCASE(BadDrawable);
+ XERRORCASE(BadFont);
+ XERRORCASE(BadGC);
+ XERRORCASE(BadIDChoice);
+ XERRORCASE(BadImplementation);
+ XERRORCASE(BadLength);
+ XERRORCASE(BadMatch);
+ XERRORCASE(BadName);
+ XERRORCASE(BadPixmap);
+ XERRORCASE(BadRequest);
+ XERRORCASE(BadValue);
+ XERRORCASE(BadWindow);
+#undef XERRORCASE
+ default:
+ error_type = "unknown";
+ break;
+ }
+ purple_debug_error("media", "A %s Xlib error has occurred. "
+ "The program would normally crash now.\n",
+ error_type);
+ return 0;
+}
+
static void
pidgin_media_init (PidginMedia *media)
{
GtkWidget *vbox, *hbox;
media->priv = PIDGIN_MEDIA_GET_PRIVATE(media);
+ XSetErrorHandler(pidgin_x_error_handler);
+
vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
gtk_container_add(GTK_CONTAINER(media), vbox);
More information about the Commits
mailing list