This content has been marked as final. Show 3 replies
The output is saying that contains() returns true. I agree that the if statement wouldn't be executed if contains does returns true. But since it does, then that isn't the exact code you compiled and ran. You're doing something else.
Or is your claim that contains() is sometimes returning false (for the if statement) and sometimes returning true (for the debugString)?
OK, the code isn't 100% the same: there's a line which displays a Dialog box to let me know that there's been a error.
If I take this out, the call to "contains" now returns False, and the values of the elements in the path have changed as well (so the point is no longer inside the path). The output is now:
Winding rule: 1
Point: 64, 64
Segment type 0: 18.0, 5.0
Segment type 1: -6.0, 5.0
Segment type 1: -6.0, -6.0
Segment type 1: 5.0, -6.0
Segment type 1: 5.0, 16.0
So the question has now changed to: how does displaying a Dialog box (and then of course clicking a button to make it disappear) affect the contents of a GeneralPath? As far as I can see, the only thing that's changed is the position of the cursor. I'll have to investigate more, but in the meantime any ideas are welcome.
It seems that for reasons that I have yet to determine, the routine is being interrupted by a FormComponentResized event which is calling it recursively - between the conditional and the message appearing the conditions have changed and the shape of the path recalculated - so the condition becomes true by the time the message appears.
So it seems that "contains" works properly (which isn't surprising) but a synchronisation bug in my code.
Edited by: ptoye on Apr 29, 2013 1:23 AM - reason for problem found.