unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Richard Copley <rcopley@gmail.com>
Cc: 25875@debbugs.gnu.org
Subject: bug#25875: 26.0.50; Hang logging out of MS-Windows
Date: Mon, 27 Feb 2017 17:37:36 -0500	[thread overview]
Message-ID: <648f03f0-e4d4-c04e-afbf-d8ef8741b15e@cornell.edu> (raw)
In-Reply-To: <CAPM58oizEaMnVxcA088CLFmSr98MBvrfKCDSi5tZTVhE-1=5MQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

On 2/27/2017 3:14 AM, Richard Copley wrote:
> Sorry Ken, I can't sabotage myself like that, I have work to do.

FWIW, I'm attaching a corrected version of the patch.  With one 
exception, it only replaces SendMessage by SendMessageTimeout in cases 
where the return value of SendMessage was not used.  In the exceptional 
case, the return value was only tested to see if it was 0 or not, so I 
think the replacement is still correct.

Richard, it's your call whether or not it's worthwhile for you to run 
with this patch for a while and see what happens.  I understand that 
this might not give a definitive answer.

I still want to eventually apply the patch I posted in 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25875#41, which I think 
will solve the problem in a less satisfactory way.  But I'd rather hold 
off on that in the hope that we'll get some evidence as to whether we've 
correctly diagnosed the problem.

Ken

[-- Attachment #2: SendMessageTimeout.patch --]
[-- Type: text/plain, Size: 3087 bytes --]

diff --git a/src/w32term.c b/src/w32term.c
index d6b78fd..ba646fb 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -548,7 +548,8 @@ x_update_window_begin (struct window *w)
   /* Hide the system caret during an update.  */
   if (w32_use_visible_system_caret && w32_system_caret_hwnd)
     {
-      SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0);
+      SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0,
+			  0, 100, NULL);
     }
 
   w->output_cursor = w->cursor;
@@ -714,7 +715,8 @@ x_update_window_end (struct window *w, bool cursor_on_p,
      x_update_window_begin.  */
   if (w32_use_visible_system_caret && w32_system_caret_hwnd)
     {
-      SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0);
+      SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0,
+			  0, 100, NULL);
     }
 }
 
@@ -3668,8 +3670,8 @@ static BOOL
 my_show_window (struct frame *f, HWND hwnd, int how)
 {
 #ifndef ATTACH_THREADS
-  return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW,
-		      (WPARAM) hwnd, (LPARAM) how);
+  return SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW,
+			     (WPARAM) hwnd, (LPARAM) how, 0, 100, NULL);
 #else
   return ShowWindow (hwnd, how);
 #endif
@@ -3687,7 +3689,8 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter,
   pos.cx = cx;
   pos.cy = cy;
   pos.flags = flags;
-  SendMessage (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0);
+  SendMessageTimeout (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0,
+		      0, 100, NULL);
 #else
   SetWindowPos (hwnd, hwndAfter, x, y, cx, cy, flags);
 #endif
@@ -3697,29 +3700,31 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter,
 static void
 my_set_focus (struct frame * f, HWND hwnd)
 {
-  SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,
-	       (WPARAM) hwnd, 0);
+  SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,
+		      (WPARAM) hwnd, 0, 0, 100, NULL);
 }
 #endif
 
 static void
 my_set_foreground_window (HWND hwnd)
 {
-  SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0);
+  SendMessageTimeout (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0,
+		      0, 100, NULL);
 }
 
 
 static void
 my_destroy_window (struct frame * f, HWND hwnd)
 {
-  SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,
-	       (WPARAM) hwnd, 0);
+  SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,
+		      (WPARAM) hwnd, 0, 0, 100, NULL);
 }
 
 static void
 my_bring_window_to_top (HWND hwnd)
 {
-  SendMessage (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0);
+  SendMessageTimeout (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0,
+		      0, 100, NULL);
 }
 
 /* Create a scroll bar and return the scroll bar vector for it.  W is
@@ -6538,7 +6543,8 @@ x_iconify_frame (struct frame *f)
   x_set_bitmap_icon (f);
 
   /* Simulate the user minimizing the frame.  */
-  SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0);
+  SendMessageTimeout (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0,
+		      0, 100, NULL);
 
   SET_FRAME_VISIBLE (f, 0);
   SET_FRAME_ICONIFIED (f, true);

  parent reply	other threads:[~2017-02-27 22:37 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-25 19:35 bug#25875: 26.0.50; Hang logging out of MS-Windows Richard Copley
2017-02-25 19:41 ` Richard Copley
2017-02-25 20:36   ` Eli Zaretskii
2017-02-25 21:13     ` Richard Copley
2017-02-26 15:47       ` Eli Zaretskii
2017-02-26 18:26         ` Richard Copley
2017-02-25 20:33 ` Eli Zaretskii
2017-02-25 21:07   ` Richard Copley
2017-02-25 21:30     ` Richard Copley
2017-02-25 21:37       ` Richard Copley
2017-02-25 22:02         ` Richard Copley
2017-02-26 15:47           ` Eli Zaretskii
2017-02-26 18:37             ` Richard Copley
2017-02-26 15:44     ` Eli Zaretskii
2017-02-26 18:04       ` Ken Brown
2017-02-26 18:25         ` Eli Zaretskii
2017-02-26 18:58           ` Ken Brown
2017-02-26 19:25             ` Eli Zaretskii
2017-02-26 23:38               ` Ken Brown
2017-02-27  8:14                 ` Richard Copley
2017-02-27 15:36                   ` Eli Zaretskii
2017-02-27 19:04                     ` Richard Copley
2017-02-27 19:16                       ` Eli Zaretskii
2017-02-27 19:23                         ` Richard Copley
2017-02-27 19:30                           ` Richard Copley
2017-02-27 19:39                             ` Ken Brown
2017-02-27 19:46                               ` Richard Copley
2017-02-27 19:56                                 ` Richard Copley
2017-02-27 20:19                                   ` Ken Brown
2017-02-27 20:27                                 ` Eli Zaretskii
2017-02-27 20:52                                   ` Richard Copley
2017-02-27 20:58                                     ` Eli Zaretskii
2017-02-27 21:09                                       ` Richard Copley
2017-02-28  3:30                                         ` Eli Zaretskii
2017-02-28  6:37                                           ` Richard Copley
2017-02-27 22:37                   ` Ken Brown [this message]
2017-02-27 23:03                     ` Richard Copley
2017-02-28  3:35                       ` Eli Zaretskii
2017-02-28  7:21                         ` Richard Copley
2017-02-28 15:36                           ` Eli Zaretskii
2017-02-28 16:40                             ` Ken Brown
2017-02-28 16:44                               ` Eli Zaretskii
2017-02-28 18:59                                 ` Richard Copley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=648f03f0-e4d4-c04e-afbf-d8ef8741b15e@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=25875@debbugs.gnu.org \
    --cc=rcopley@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).