piccolo2d / piccolo2d.java

Structured 2D Graphics Framework
http://piccolo2d.org
Other
51 stars 14 forks source link

Component doesn't receive events after PSwing is added, removed and re-added to scenegraph #158

Closed mro closed 9 years ago

mro commented 9 years ago

Originally reported on Google Code with ID 158

What steps will reproduce the problem?

Use Piccolo2D 1.3 rc1. 
Run the attached example program, DebugAddPSwing.

What is the expected output? What do you see instead?

Behavior of the JTextField in the example should be the same after it's
removed and re-added to the scenegraph.  Instead, the behavior is
different.  After re-adding, it does not receive key events and therefore
appears to be broken.

Additional info:

This example works fine with our snapshot (rev 390, circa 9/9/2008).  I
suspect (but have not confirmed) that some crucial connection to Swing is
being disconnected when the Component is removed from the scenegraph. 

Reported by cmalley@pixelzoom.com on 2010-01-27 20:36:01


mro commented 9 years ago
Fixed in r960. canvas field was not properly getting nulled out when node was removed

from the scene. So that when it was re-attached, it falsely thought it had already
been  
registered with the canvas.

Reported by allain.lalonde on 2010-01-27 21:26:27

mro commented 9 years ago
This change doesn't fix the problem when applied to 1.3 rc1.  Are you testing with rc1?

I do support this change - it's a useful fix, because updateCanvas(null) would have
resulted in a NullPointerException.  But I don't see how it could fix the problem
reported.  So I think this issue needs to be reopened.

Reported by cmalley@pixelzoom.com on 2010-01-27 22:38:50

mro commented 9 years ago
Doh! My bad. It was me that wasn't testing with rc1.  I applied the fix to rc1 and it
works.  (Sorry about that.)  I've marked this as verified.

Reported by cmalley@pixelzoom.com on 2010-01-27 22:51:54

mro commented 9 years ago
lol Thanks for that emotional roller coaster :)

Reported by allain.lalonde on 2010-01-28 00:18:22