Skip to main content

LockableUi (BusyPainterUI)

5 replies [Last post]
klaasjanelzinga
Offline
Joined: 2007-06-10
Points: 0

I think there's a mutual exclusion bug in the LockableDemo (https://jxlayer.dev.java.net/source/browse/jxlayer/trunk/src/demo/org/jd...).

The BusyPainterUI must syncronize the setLocked and the actionPerformed methods. If the setLocked is called with false there must be a call to setDirty(true).

Otherwise there would be a race condition between the setLocked(...) and the isLocked in the paintLayer. Perhaps the paintLayer must be synced but my knowledge of the base class is not enough to judge this.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
klaasjanelzinga
Offline
Joined: 2007-06-10
Points: 0

The triple posts were not a race condition, I probably hit the back button of the browser (out of habit, cos I think I can travel back in time with the back button, and that's cool), on the sun forums someone replied to me:

Elzinga, please don't edit your message using the browsers back button, as that creates multiple threads. I've deleted the double post.

klaasjanelzinga
Offline
Joined: 2007-06-10
Points: 0

The triple posts were not a race condition, I probably hit the back button of the browser (out of habit, cos I think I can travel back in time with the back button, and that's cool), on the sun forums someone replied to me:

Elzinga, please don't edit your message using the browsers back button, as that creates multiple threads. I've deleted the double post.

klaasjanelzinga
Offline
Joined: 2007-06-10
Points: 0

The triple posts were not a race condition, I probably hit the back button of the browser (out of habit, cos I think I can travel back in time with the back button, and that's cool), on the sun forums someone replied to me:

Elzinga, please don't edit your message using the browsers back button, as that creates multiple threads. I've deleted the double post.

alexfromsun
Offline
Joined: 2005-09-05
Points: 0

Hello Klaasjanelzinga

If you find a bug please provide a test case

Suggestion that a method in Swing code must synchronized is pretty weird,
because all Swing code is called on one thread,
so no synchronization is required

By the way why did you send the same message three times,
was there a race condition?
;-)

alexp

klaasjanelzinga
Offline
Joined: 2007-06-10
Points: 0

So I did not mean to sent the message three times, indeed some synchronized needed here...

The bug was my bad. I called the setLocked in a new thread and not on edt.

thanks for the reaction.