emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117131: Fix bug #17524 with crashes in creating


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117131: Fix bug #17524 with crashes in creating a new frame with invalid font.
Date: Tue, 20 May 2014 16:29:28 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117131
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17524
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Tue 2014-05-20 19:28:39 +0300
message:
  Fix bug #17524 with crashes in creating a new frame with invalid font.
  
   src/w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are
   unwinding when frame's faces were not initialized yet, increment
   the frame's image-cache reference count before calling
   x_free_frame_resources.  Don't dereference
   dpyinfo->terminal->image_cache if it is NULL.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-05-11 02:30:57 +0000
+++ b/src/ChangeLog     2014-05-20 16:28:39 +0000
@@ -1,3 +1,11 @@
+2014-05-20  Eli Zaretskii  <address@hidden>
+
+       * w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: If we are
+       unwinding when frame's faces were not initialized yet, increment
+       the frame's image-cache reference count before calling
+       x_free_frame_resources.  Don't dereference
+       dpyinfo->terminal->image_cache if it is NULL.  (Bug#17524)
+
 2014-05-11  Glenn Morris  <address@hidden>
 
        * fileio.c (Ffile_executable_p): Doc tweak.

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-05-06 16:00:30 +0000
+++ b/src/w32fns.c      2014-05-20 16:28:39 +0000
@@ -4245,6 +4245,17 @@
     {
 #ifdef GLYPH_DEBUG
       struct w32_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);
@@ -4255,7 +4266,8 @@
       eassert (dpyinfo->reference_count == dpyinfo_refcount);
       eassert ((dpyinfo->terminal->image_cache == NULL
                && image_cache_refcount == 0)
-              || dpyinfo->terminal->image_cache->refcount == 
image_cache_refcount);
+              || (dpyinfo->terminal->image_cache != NULL
+                  && dpyinfo->terminal->image_cache->refcount == 
image_cache_refcount));
 #endif
       return Qt;
     }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]