Subject: Re: bug#22438: 24.5; Orphaned tooltip kills daemon (Lucid)

From: Óscar Fuentes <[email-masked]>
Date: Sat, 23 Jan 2016 00:56:03 +0100

Nicole Edwards <[email-masked]> writes:

> If I call up (or dismiss all but) one frame, ask it to display
> a tooltip, then destroy it while the tooltip is open, the tooltip
> remains open, and unless I create a new frame within a few seconds,
> Emacs dies.  (Mercifully, so does the tooltip.)

[snip]

The problem is in src/xfns.c:6087. Emacs explicitly redisplays the
current frame's menu bar without testing that it is alive. The patch
below solves the problem. Eli, ok to commit?

diff --git a/src/xfns.c b/src/xfns.c
index aad9680..9624ac5 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -6084,16 +6084,19 @@ Value is t if tooltip was open, nil otherwise.  */)
 	 items is unmapped.  Redisplay the menu manually...  */
       {
         Widget w;
-	struct frame *f = SELECTED_FRAME ();
-	w = f->output_data.x->menubar_widget;
+        struct frame *f = SELECTED_FRAME ();
+        if (FRAME_X_P (f) && FRAME_LIVE_P (f))
+          {
+          w = f->output_data.x->menubar_widget;
 
-	if (!DoesSaveUnders (FRAME_DISPLAY_INFO (f)->screen)
-	    && w != NULL)
-	  {
-	    block_input ();
-	    xlwmenu_redisplay (w);
-	    unblock_input ();
-	  }
+          if (!DoesSaveUnders (FRAME_DISPLAY_INFO (f)->screen)
+              && w != NULL)
+            {
+              block_input ();
+              xlwmenu_redisplay (w);
+              unblock_input ();
+            }
+        }
       }
 #endif /* USE_LUCID */
     }