emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113100: Yet another attempt at fixing bugs #14602,


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r113100: Yet another attempt at fixing bugs #14602, 14630, 14669.
Date: Thu, 20 Jun 2013 17:37:13 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113100
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/14669
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2013-06-20 20:36:24 +0300
message:
  Yet another attempt at fixing bugs #14602, 14630, 14669.
  
   src/w32fns.c (w32_wnd_proc): Don't compute the header line and mode
   line dimensions here, to avoid race conditions with the main
   thread.
   src/w32term.c (w32_draw_window_cursor): Compute the header line and
   mode line dimensions here.
   <w32_system_caret_window, w32_system_caret_hdr_height>:
   <w32_system_caret_mode_height>: New variables.
   src/w32term.h: Declare them.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
  src/w32term.c                  w32term.c-20091113204419-o5vbwnq5f7feedwu-950
  src/w32term.h                  w32term.h-20091113204419-o5vbwnq5f7feedwu-954
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-06-20 14:47:46 +0000
+++ b/src/ChangeLog     2013-06-20 17:36:24 +0000
@@ -1,3 +1,16 @@
+2013-06-20  Eli Zaretskii  <address@hidden>
+
+       * w32fns.c (w32_wnd_proc): Don't compute the header line and mode
+       line dimensions here, to avoid race conditions with the main
+       thread.  (Bug#14062, bug#14630, bug#14669)
+
+       * w32term.c (w32_draw_window_cursor): Compute the header line and
+       mode line dimensions here.
+       <w32_system_caret_window, w32_system_caret_hdr_height>:
+       <w32_system_caret_mode_height>: New variables.
+
+       * w32term.h: Declare them.
+
 2013-06-20  Paul Eggert  <address@hidden>
 
        * alloc.c (die): Move "assertion failed" string here ...

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2013-06-17 16:28:47 +0000
+++ b/src/w32fns.c      2013-06-20 17:36:24 +0000
@@ -3175,23 +3175,39 @@
          HIMC context;
          struct window *w;
 
+         /* Implementation note: The code below does something that
+            one shouldn't do: it accesses the window object from a
+            separate thread, while the main (a.k.a. "Lisp") thread
+            runs and can legitimately delete and even GC it.  That is
+            why we are extra careful not to futz with a window that
+            is different from the one recorded when the system caret
+            coordinates were last modified.  That is also why we are
+            careful not to move the IME window if the window
+            described by W was deleted, as indicated by its buffer
+            field being reset to nil.  */
          f = x_window_to_frame (dpyinfo, hwnd);
          w = XWINDOW (FRAME_SELECTED_WINDOW (f));
+         /* Punt if someone changed the frame's selected window
+            behind our back. */
+         if (w != w32_system_caret_window)
+           break;
 
          form.dwStyle = CFS_RECT;
          form.ptCurrentPos.x = w32_system_caret_x;
          form.ptCurrentPos.y = w32_system_caret_y;
 
          form.rcArea.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, 0);
-         form.rcArea.top = WINDOW_TOP_EDGE_Y (w);
-         if (BUFFERP (w->contents)
-             && FRAMEP (WINDOW_FRAME (w)))
-           form.rcArea.top += WINDOW_HEADER_LINE_HEIGHT (w);
+         form.rcArea.top = (WINDOW_TOP_EDGE_Y (w)
+                            + w32_system_caret_hdr_height);
          form.rcArea.right = (WINDOW_BOX_RIGHT_EDGE_X (w)
                               - WINDOW_RIGHT_MARGIN_WIDTH (w)
                               - WINDOW_RIGHT_FRINGE_WIDTH (w));
          form.rcArea.bottom = (WINDOW_BOTTOM_EDGE_Y (w)
-                               - WINDOW_MODE_LINE_HEIGHT (w));
+                               - w32_system_caret_mode_height);
+
+         /* Punt if the window was deleted behind our back.  */
+         if (!BUFFERP (w->contents))
+           break;
 
          context = get_ime_context_fn (hwnd);
 

=== modified file 'src/w32term.c'
--- a/src/w32term.c     2013-06-03 19:06:09 +0000
+++ b/src/w32term.c     2013-06-20 17:36:24 +0000
@@ -151,6 +151,9 @@
 int w32_system_caret_height;
 int w32_system_caret_x;
 int w32_system_caret_y;
+struct window *w32_system_caret_window;
+int w32_system_caret_hdr_height;
+int w32_system_caret_mode_height;
 DWORD dwWindowsThreadId = 0;
 HANDLE hWindowsThread = NULL;
 DWORD dwMainThreadId = 0;
@@ -5328,6 +5331,9 @@
          w32_system_caret_y
            = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
               + glyph_row->ascent - w->phys_cursor_ascent);
+         w32_system_caret_window = w;
+         w32_system_caret_hdr_height = WINDOW_HEADER_LINE_HEIGHT (w);
+         w32_system_caret_mode_height = WINDOW_MODE_LINE_HEIGHT (w);
 
          PostMessage (hwnd, WM_IME_STARTCOMPOSITION, 0, 0);
 

=== modified file 'src/w32term.h'
--- a/src/w32term.h     2013-06-03 19:28:13 +0000
+++ b/src/w32term.h     2013-06-20 17:36:24 +0000
@@ -750,6 +750,9 @@
 extern int w32_system_caret_height;
 extern int w32_system_caret_x;
 extern int w32_system_caret_y;
+extern struct window *w32_system_caret_window;
+extern int w32_system_caret_hdr_height;
+extern int w32_system_caret_mode_height;
 
 #ifdef _MSC_VER
 #ifndef EnumSystemLocales


reply via email to

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