Subject: bug#12007: probably a fix

From: Dmitry Antipov <[email-masked]>
Date: Wed, 15 Aug 2012 20:34:17 +0400

On 08/13/2012 11:24 PM, Eli Zaretskii wrote:

> Perhaps related, the current trunk (revision 109586) segfaults on
> startup ("emacs -Q") on GNU/Linux, with the following backtrace:

Eli, please review a fix.

This looks simple: it's wrong to look at with f->output_data.XXX without
checking f->output_method first, so, FRAME_X_OUTPUT (f) may be non-zero
for TTY frames, and segfault comes when xg_mark_data looks at initial
("F1") frame with non-zero f->output_data.tty member.

Dmitry

=== modified file 'src/gtkutil.c'
--- src/gtkutil.c	2012-08-15 09:40:00 +0000
+++ src/gtkutil.c	2012-08-15 16:22:28 +0000
@@ -2259,7 +2259,7 @@
     {
       FRAME_PTR f = XFRAME (frame);
 
-      if (FRAME_X_OUTPUT (f) && FRAME_GTK_OUTER_WIDGET (f))
+      if (FRAME_X_P (f) && FRAME_GTK_OUTER_WIDGET (f))
         {
           struct xg_frame_tb_info *tbinfo
             = g_object_get_data (G_OBJECT (FRAME_GTK_OUTER_WIDGET (f)),