[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115269: Fix bug #15933 with crashes in file-notify-
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] trunk r115269: Fix bug #15933 with crashes in file-notify-tests on MS-Windows. |
Date: |
Thu, 28 Nov 2013 19:42:05 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115269
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15933
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2013-11-28 21:40:15 +0200
message:
Fix bug #15933 with crashes in file-notify-tests on MS-Windows.
Support w32 file notifications in batch mode.
src/w32proc.c (sys_select): Don't wait on interrupt_handle if it is
invalid (which happens in batch mode). If non-interactive, call
handle_file_notifications to store file notification events in the
input queue.
src/w32notify.c (send_notifications): Handle FRAME_INITIAL frames as
well.
src/w32inevt.c (handle_file_notifications): Now external, not
static.
src/w32term.h (handle_file_notifications): Provide prototype.
src/emacs.c (main) [HAVE_W32NOTIFY]: When non-interactive, call
init_crit, since init_display, which does that otherwise, is not
called.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/emacs.c emacs.c-20091113204419-o5vbwnq5f7feedwu-241
src/w32inevt.c w32inevt.c-20091113204419-o5vbwnq5f7feedwu-813
src/w32notify.c w32notify.c-20121007123611-xyh65j2ka2vm684f-1
src/w32proc.c w32proc.c-20091113204419-o5vbwnq5f7feedwu-814
src/w32term.h w32term.h-20091113204419-o5vbwnq5f7feedwu-954
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-11-27 18:25:44 +0000
+++ b/src/ChangeLog 2013-11-28 19:40:15 +0000
@@ -1,3 +1,23 @@
+2013-11-28 Eli Zaretskii <address@hidden>
+
+ Support w32 file notifications in batch mode.
+ * w32proc.c (sys_select): Don't wait on interrupt_handle if it is
+ invalid (which happens in batch mode). If non-interactive, call
+ handle_file_notifications to store file notification events in the
+ input queue. (Bug#15933)
+
+ * w32notify.c (send_notifications): Handle FRAME_INITIAL frames as
+ well.
+
+ * w32inevt.c (handle_file_notifications): Now external, not
+ static.
+
+ * w32term.h (handle_file_notifications): Provide prototype.
+
+ * emacs.c (main) [HAVE_W32NOTIFY]: When non-interactive, call
+ init_crit, since init_display, which does that otherwise, is not
+ called.
+
2013-11-27 Glenn Morris <address@hidden>
* Makefile.in ($(lispsource)/international/charprop.el): New.
=== modified file 'src/emacs.c'
--- a/src/emacs.c 2013-11-23 01:55:16 +0000
+++ b/src/emacs.c 2013-11-28 19:40:15 +0000
@@ -1517,6 +1517,10 @@
init_keyboard (); /* This too must precede init_sys_modes. */
if (!noninteractive)
init_display (); /* Determine terminal type. Calls init_sys_modes. */
+#if HAVE_W32NOTIFY
+ else
+ init_crit (); /* w32notify.c needs this in batch mode. */
+#endif /* HAVE_W32NOTIFY */
init_xdisp ();
#ifdef HAVE_WINDOW_SYSTEM
init_fringe ();
=== modified file 'src/w32inevt.c'
--- a/src/w32inevt.c 2013-11-05 07:44:14 +0000
+++ b/src/w32inevt.c 2013-11-28 19:40:15 +0000
@@ -608,7 +608,7 @@
}
#if HAVE_W32NOTIFY
-static int
+int
handle_file_notifications (struct input_event *hold_quit)
{
BYTE *p = file_notifications;
@@ -676,7 +676,7 @@
return nevents;
}
#else /* !HAVE_W32NOTIFY */
-static int
+int
handle_file_notifications (struct input_event *hold_quit)
{
return 0;
=== modified file 'src/w32notify.c'
--- a/src/w32notify.c 2013-11-27 16:03:02 +0000
+++ b/src/w32notify.c 2013-11-28 19:40:15 +0000
@@ -163,7 +163,12 @@
&& PostThreadMessage (dwMainThreadId, WM_EMACS_FILENOTIFY, 0, 0))
|| (FRAME_W32_P (f)
&& PostMessage (FRAME_W32_WINDOW (f),
- WM_EMACS_FILENOTIFY, 0, 0)))
+ WM_EMACS_FILENOTIFY, 0, 0))
+ /* When we are running in batch mode, there's no one to
+ send a message, so we just signal the data is
+ available and hope sys_select will be called soon and
+ will read the data. */
+ || (FRAME_INITIAL_P (f) && noninteractive))
notification_buffer_in_use = 1;
done = 1;
}
=== modified file 'src/w32proc.c'
--- a/src/w32proc.c 2013-10-14 16:23:10 +0000
+++ b/src/w32proc.c 2013-11-28 19:40:15 +0000
@@ -1960,12 +1960,17 @@
FD_ZERO (rfds);
nr = 0;
- /* Always wait on interrupt_handle, to detect C-g (quit). */
- wait_hnd[0] = interrupt_handle;
- fdindex[0] = -1;
+ /* If interrupt_handle is available and valid, always wait on it, to
+ detect C-g (quit). */
+ nh = 0;
+ if (interrupt_handle && interrupt_handle != INVALID_HANDLE_VALUE)
+ {
+ wait_hnd[0] = interrupt_handle;
+ fdindex[0] = -1;
+ nh++;
+ }
/* Build a list of pipe handles to wait on. */
- nh = 1;
for (i = 0; i < nfds; i++)
if (FD_ISSET (i, &orfds))
{
@@ -1986,6 +1991,11 @@
FD_SET (i, rfds);
return 1;
}
+ else if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ return 1;
+ }
}
else
{
@@ -2086,6 +2096,11 @@
{
if (timeout)
Sleep (timeout_ms);
+ if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ return 1;
+ }
return 0;
}
@@ -2112,6 +2127,11 @@
}
else if (active == WAIT_TIMEOUT)
{
+ if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ return 1;
+ }
return 0;
}
else if (active >= WAIT_OBJECT_0
@@ -2218,6 +2238,12 @@
break;
} while (active < nh + nc);
+ if (noninteractive)
+ {
+ if (handle_file_notifications (NULL))
+ nr++;
+ }
+
/* If no input has arrived and timeout hasn't expired, wait again. */
if (nr == 0)
{
=== modified file 'src/w32term.h'
--- a/src/w32term.h 2013-10-29 05:55:25 +0000
+++ b/src/w32term.h 2013-11-28 19:40:15 +0000
@@ -680,6 +680,7 @@
extern void *notifications_desc;
extern Lisp_Object w32_get_watch_object (void *);
extern Lisp_Object lispy_file_action (DWORD);
+extern int handle_file_notifications (struct input_event *);
extern void w32_initialize_display_info (Lisp_Object);
extern void initialize_w32_display (struct terminal *, int *, int *);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115269: Fix bug #15933 with crashes in file-notify-tests on MS-Windows.,
Eli Zaretskii <=