Subject: bug#17975: 24.3.92; assertion failure deleting frames with varying names for the same display (and, using multiple X11 connections in that case too)

From: Dmitry Antipov <[email-masked]>
Date: Sun, 13 Jul 2014 09:43:32 +0400

On 07/12/2014 01:22 AM, Ken Raeburn wrote:

> It works for me too. Of course, my saved .emacs.desktop already has a
> mix of display names in it; I'll have to get them in sync.

I think this won't help if you're really using multiple displays,
for example, :0.0 and :1.0.

> But of course it isn't going to address some reasonable uses of
> make-frame-on-display (including perhaps old scripts some of us may have
> lying around that invoke make-frame-on-display by way of emacsclient
> --eval). Perhaps a similar change can be made within the main Emacs
> code?

I'm afraid that we can't do anything useful on Emacs side because of libX11 bug.
If you can rebuild libX11 from git, you can try this patch; I think we should
create bug report at http://bugs.freedesktop.org...

Dmitry

diff --git a/modules/im/ximcp/imInsClbk.c b/modules/im/ximcp/imInsClbk.c
index d5527e0..97ed616 100644
--- a/modules/im/ximcp/imInsClbk.c
+++ b/modules/im/ximcp/imInsClbk.c
@@ -175,7 +175,14 @@ _XimRegisterIMInstantiateCallback(
     icb->display = display;
     icb->lcd = lcd;
     MakeLocale( lcd, icb->name );
-    icb->modifiers = lcd->core->modifiers;	/* XXXXX */
+    if ( lcd->core->modifiers ) {
+	icb->modifiers = strdup( lcd->core->modifiers ); /* XXXXX */
+	if ( icb->modifiers == NULL ) {
+	    Xfree( icb );
+	    return( False );
+	}
+    } else
+	icb->modifiers = NULL;
     icb->rdb = rdb;
     icb->res_name = res_name;
     icb->res_class = res_class;
@@ -258,6 +265,8 @@ _XimUnRegisterIMInstantiateCallback(
 		else
 		    picb->next = icb->next;
 		_XCloseLC( icb->lcd );
+		if( icb->modifiers )
+		    free( icb->modifiers );
 		XFree( icb );
 	    }
 	    return( True );