From 9c69714eec3561088540ca089de8bc5d6fa776f0 Mon Sep 17 00:00:00 2001 From: neil Date: Mon, 3 Nov 2014 02:16:23 +0000 Subject: [PATCH] Moved the dereferencing of a window pointer to after the check for its being non-NULL. Previously, the NULL check was being optimised away by GCC (presumably the thinking is: if it's already been dereferenced, it must be non-NULL), leading to a race condition that sometimes caused BOOPSI method calls to an invalid monitor (i.e. screen) object. This fixes the crash sometimes seen when changing screen mode when DOpus Magellan is used as a Workbench replacement. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49749 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/intuition/inputhandler.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rom/intuition/inputhandler.c b/rom/intuition/inputhandler.c index e22f23d137..b6f5bfe161 100644 --- a/rom/intuition/inputhandler.c +++ b/rom/intuition/inputhandler.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2013, The AROS Development Team. All rights reserved. + Copyright © 1995-2014, The AROS Development Team. All rights reserved. Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved. $Id$ */ @@ -2561,16 +2561,17 @@ AROS_UFH2(struct InputEvent *, IntuiInputHandler, struct SharedPointer *shared_pointer; struct Window *window = IntuitionBase->ActiveWindow; struct IntScreen *scr; - Object *pointer = ((struct IntWindow *)window)->pointer; DEBUG_POINTER(dprintf("InputHandler: PointerDelay\n")); - DEBUG_POINTER(dprintf("InputHandler: Pointer 0x%lx\n", - pointer)); + DEBUG_POINTER(dprintf("InputHandler: Window 0x%lx\n", + window)); if (window) { - DEBUG_POINTER(dprintf("InputHandler: Window 0x%lx\n", - window)); + Object *pointer = ((struct IntWindow *)window)->pointer; + + DEBUG_POINTER(dprintf("InputHandler: Pointer 0x%lx\n", + pointer)); scr = GetPrivScreen(window->WScreen); if (scr) { -- 2.11.4.GIT