Race conditions in UI code

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

Race conditions in UI code

Postby Michael Keppler » Thu Apr 09, 2009 6:40 am

In this code:
Code: Select all
isShellUnderPointerActive
   self adapterUnderPointer isNil
      ifTrue: [^false].

   ^self adapterUnderPointer widgetShell == CwWMShell focusShell or:
      [self adapterUnderPointer visualPolicy notNil and:
      [self adapterUnderPointer visualPolicy popupWhenShellInactive == true]]


I got a "UndefinedObject does not understand visualPolicy". That's clearly a problem of "self adapterUnderPointer" toggling between the different calls. To my mind code like this must always use a local variable, where the result of the method call is stored, independently of whether the method call returns only a member variable or does some crazy calculation.
Code like the one above (with multiple method calls meaning to return the identical object) can probably be found in many more places throughout the system. Isn't that a very general problem? I guess that the chance of actually running into this problem is really small as typical user generated UI events just don't come fast enough into the message queue. But we see problems like this occur more often with automated UI testing (where the code is under much higher stress).

Does anyone else experience problems like this with automated UI testing? If so, what do you to get around these issues?
Michael Keppler
 
Posts: 28
Joined: Wed Feb 27, 2008 4:33 am

Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest