diff src/ui.c @ 17708:10696f279e20 v8.1.1851

patch 8.1.1851: crash when sound_playfile() callback plays sound commit https://github.com/vim/vim/commit/28e67e0c1496b7bb166a0acfb176690f219101ca Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 15 23:05:49 2019 +0200 patch 8.1.1851: crash when sound_playfile() callback plays sound Problem: Crash when sound_playfile() callback plays sound. Solution: Invoke callback later from event loop.
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Aug 2019 23:15:04 +0200
parents d5e5d0fc3fa8
children f800c3d8ca1b
line wrap: on
line diff
--- a/src/ui.c
+++ b/src/ui.c
@@ -459,12 +459,22 @@ ui_wait_for_chars_or_timer(
 	}
 	if (due_time <= 0 || (wtime > 0 && due_time > remaining))
 	    due_time = remaining;
-# ifdef FEAT_JOB_CHANNEL
-	if ((due_time < 0 || due_time > 10L)
-#  ifdef FEAT_GUI
-		&& !gui.in_use
+# if defined(FEAT_JOB_CHANNEL) || defined(FEAT_SOUND_CANBERRA)
+	if ((due_time < 0 || due_time > 10L) && (
+#  if defined(FEAT_JOB_CHANNEL)
+		(
+#   if defined(FEAT_GUI)
+		!gui.in_use &&
+#   endif
+		(has_pending_job() || channel_any_readahead()))
+#   ifdef FEAT_SOUND_CANBERRA
+		||
+#   endif
 #  endif
-		&& (has_pending_job() || channel_any_readahead()))
+#  ifdef FEAT_SOUND_CANBERRA
+		    has_any_sound_callback()
+#  endif
+		    ))
 	{
 	    // There is a pending job or channel, should return soon in order
 	    // to handle them ASAP.  Do check for input briefly.