diff src/scrollbar-msw.c @ 664:6e99cc8c6ca5

[xemacs-hg @ 2001-09-18 05:04:26 by ben] fileio.c: Fix various C++ compile errors in Andy's recent code. callint.c, editfns.c, emacs.c, lread.c, redisplay-x.c: Fix sign-compare warnings. scrollbar-msw.c: Fix crash under MS Windows. See comment around line 223 for explanation. font-lock.el: fix problem when you insert a comment on the line before a line of code: if we use the following char, then when you hit backspace, the following line of code turns the comment color. configure.in: Don't use -Wshadow when compiling with g++ or you get buried in silly warnings. This patch was already applied but somehow got unapplied. Stephen?
author ben
date Tue, 18 Sep 2001 05:06:57 +0000
parents af57a77cbc92
children fdefd0186b75
line wrap: on
line diff
--- a/src/scrollbar-msw.c	Mon Sep 17 07:48:36 2001 +0000
+++ b/src/scrollbar-msw.c	Tue Sep 18 05:06:57 2001 +0000
@@ -3,6 +3,7 @@
    Copyright (C) 1994 Amdahl Corporation.
    Copyright (C) 1995 Sun Microsystems, Inc.
    Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>.
+   Copyright (C) 2001 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -218,7 +219,18 @@
       assert (OPAQUE_PTRP (ptr));
       ptr = Fgethash (ptr, Vmswindows_scrollbar_instance_table, Qnil);
       sb = XSCROLLBAR_INSTANCE (ptr);
-      win = real_window (sb->mirror, 0);
+      /* #### we're still hitting an abort here with 0 as the second
+         parameter, although only occasionally.  It seems that sometimes we
+         receive events for scrollbars that don't exist anymore.  I assume
+         it must happen like this: The user does something that causes a
+         scrollbar to disappear (e.g. Alt-TAB, causing recomputation of
+         everything in the new frame) and then immediately uses the mouse
+         wheel, generating scrollbar events.  Both events get posted before
+         we have a chance to process them, and in processing the first, the
+         scrollbar mentioned in the second disappears. */
+      win = real_window (sb->mirror, 1);
+      if (NILP (win))
+	return;
       frame = WINDOW_FRAME (XWINDOW (win));
       f = XFRAME (frame);
     }