From a06776b28ce0669aff5178c5950e134f6a5ed5bb Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 5 Nov 2011 18:25:16 +0200 Subject: [PATCH] Modify w32fns.c similarly to 2011-11-05T12:04:34Z!jan.h.d@swipnet.se. src/w32fns.c (x_create_tip_frame, Fx_create_frame): Rearrange initialization code to keep similarity to xfns.c after changes from 2011-11-05. Fixes: debbugs:9943 --- src/ChangeLog | 6 ++++++ src/w32fns.c | 20 +++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index c66692ca7c7..0d3e7d9ee21 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-11-05 Eli Zaretskii + + * w32fns.c (x_create_tip_frame, Fx_create_frame): Rearrange + initialization code to keep similarity to xfns.c after changes + from 2011-11-05. + 2011-11-05 Jan Djärv * nsfns.m: Declare image_cache_refcount if GLYPH_DEBUG. diff --git a/src/w32fns.c b/src/w32fns.c index 6380a87098a..6f32442514a 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -3977,7 +3977,7 @@ x_make_gc (struct frame *f) /* Handler for signals raised during x_create_frame and - x_create_top_frame. FRAME is the frame which is partially + x_create_tip_frame. FRAME is the frame which is partially constructed. */ static Lisp_Object @@ -4135,7 +4135,6 @@ This function is an internal primitive--use `make-frame' instead. */) FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = GetSystemMetrics (SM_CXVSCROLL); f->terminal = dpyinfo->terminal; - f->terminal->reference_count++; f->output_method = output_w32; f->output_data.w32 = @@ -4154,7 +4153,8 @@ This function is an internal primitive--use `make-frame' instead. */) /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe. */ record_unwind_protect (unwind_create_frame, frame); #if GLYPH_DEBUG - image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; + image_cache_refcount = + FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0; dpyinfo_refcount = dpyinfo->reference_count; #endif /* GLYPH_DEBUG */ @@ -4287,6 +4287,7 @@ This function is an internal primitive--use `make-frame' instead. */) x_make_gc (f); /* Now consider the frame official. */ + f->terminal->reference_count++; FRAME_W32_DISPLAY_INFO (f)->reference_count++; Vframe_list = Fcons (frame, Vframe_list); @@ -5229,7 +5230,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, from this point on, x_destroy_window might screw up reference counts etc. */ f->terminal = dpyinfo->terminal; - f->terminal->reference_count++; f->output_method = output_w32; f->output_data.w32 = (struct w32_output *) xmalloc (sizeof (struct w32_output)); @@ -5239,7 +5239,8 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, f->icon_name = Qnil; #if GLYPH_DEBUG - image_cache_refcount = FRAME_IMAGE_CACHE (f)->refcount; + image_cache_refcount = + FRAME_IMAGE_CACHE ? FRAME_IMAGE_CACHE (f)->refcount : 0; dpyinfo_refcount = dpyinfo->reference_count; #endif /* GLYPH_DEBUG */ FRAME_KBOARD (f) = kb; @@ -5380,15 +5381,16 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, UNGCPRO; + /* Now that the frame is official, it counts as a reference to + its display. */ + FRAME_W32_DISPLAY_INFO (f)->reference_count++; + f->terminal->reference_count++; + /* It is now ok to make the frame official even if we get an error below. And the frame needs to be on Vframe_list or making it visible won't work. */ Vframe_list = Fcons (frame, Vframe_list); - /* Now that the frame is official, it counts as a reference to - its display. */ - FRAME_W32_DISPLAY_INFO (f)->reference_count++; - /* Setting attributes of faces of the tooltip frame from resources and similar will increment face_change_count, which leads to the clearing of all current matrices. Since this isn't necessary -- 2.39.2