Subject: bug#17524: 24.4.50; emacs_backtrace.txt

From: Michael Heerdegen <[email-masked]>
Date: Fri, 23 May 2014 00:46:45 +0200

Hello,

Hope I did what you meant.  This is what I tried:

*** /tmp/ediff3444YHS	2014-05-23 00:42:39.365203371 +0200
--- /home/micha/software/emacs/src/xfns.c	2014-05-23 00:17:59.787938756 +0200
***************
*** 2694,2699 ****
--- 2694,2710 ----
      {
  #if defined GLYPH_DEBUG && defined ENABLE_CHECKING
        struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+       
+       /* If the frame's image cache refcount is still the same as our
+ 	 private shadow variable, it means we are unwinding a frame
+ 	 for which we didn't yet call init_frame_faces, where the
+ 	 refcount is incremented.  Therefore, we increment it here, so
+ 	 that free_frame_faces, called in x_free_frame_resources
+ 	 below, will not mistakenly decrement the counter that was not
+ 	 incremented yet to account for this new frame.  */
+       if (FRAME_IMAGE_CACHE (f) != NULL
+ 	  && FRAME_IMAGE_CACHE (f)->refcount == image_cache_refcount)
+ 	FRAME_IMAGE_CACHE (f)->refcount++;
  #endif
  
        x_free_frame_resources (f);
***************
*** 2702,2708 ****
  #if defined GLYPH_DEBUG && defined ENABLE_CHECKING
        /* Check that reference counts are indeed correct.  */
        eassert (dpyinfo->reference_count == dpyinfo_refcount);
!       eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
  #endif
        return Qt;
      }
--- 2713,2720 ----
  #if defined GLYPH_DEBUG && defined ENABLE_CHECKING
        /* Check that reference counts are indeed correct.  */
        eassert (dpyinfo->reference_count == dpyinfo_refcount);
!       eassert (dpyinfo->terminal->image_cache != NULL
!                && dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
  #endif
        return Qt;
      }

Was that correct?  In any case, it crashed again:

Michael.