This site requires JavaScript, please enable it in your browser!
Greenfoot back
SPower
SPower wrote ...

2013/10/12

Greenfoot Bug

1
2
SPower SPower

2013/10/12

#
Hi Greenfoot team, I discovered a bug, actually 2 of them:
  • When you call Greenfoot.start() in your world's constructor, sometimes you are still able to drag actors around in the world, while it says the scenario is running: it's like it's both running and paused, if that makes sense
  • When dragging around an object, using the previous bug, and that object removes itself, a NullPointerException will be thrown. This is what the debugger says: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at greenfoot.Actor.setLocationInPixels(Actor.java:446) at greenfoot.ActorVisitor.setLocationInPixels(ActorVisitor.java:39) at greenfoot.core.WorldHandler.drag(WorldHandler.java:712) at greenfoot.core.WorldHandler.mouseDragged(WorldHandler.java:938) at greenfoot.gui.input.InputManager.mouseDragged(InputManager.java:303) at java.awt.Component.processMouseMotionEvent(Component.java:6337) at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3285) at java.awt.Component.processEvent(Component.java:6058) at java.awt.Container.processEvent(Container.java:2041) at java.awt.Component.dispatchEventImpl(Component.java:4652) at java.awt.Container.dispatchEventImpl(Container.java:2099) at java.awt.Component.dispatchEvent(Component.java:4482) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4255) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168) at java.awt.Container.dispatchEventImpl(Container.java:2085) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4482) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644) at java.awt.EventQueue.access$000(EventQueue.java:85) at java.awt.EventQueue$1.run(EventQueue.java:603) at java.awt.EventQueue$1.run(EventQueue.java:601) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98) at java.awt.EventQueue$2.run(EventQueue.java:617) at java.awt.EventQueue$2.run(EventQueue.java:615) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:614) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
I hope those bugs aren't too hard to fix :)
Zamoht Zamoht

2013/10/12

#
I have had the same problem when calling Greenfoot.start() in the world constructor for a long time.
bourne bourne

2013/10/12

#
Same. You can fix it by pausing and then unpausing the scenario. Maybe you can submit your report directly to the Greenfoot support team: http://www.greenfoot.org/support I've also have the bug where the scenario loses keyboard focus and clicking on the scenario fixes it. Tends to happens soon after running the scenario.
SPower SPower

2013/10/12

#
@bourne Yeah, I had already figured out I can pause it and run it again, but I thought that it actually really shouldn't be there, especially because I've now got the habit of pausing and running any scenario I see :(.
bourne bourne

2013/10/12

#
Agreed.
davmac davmac

2013/10/14

#
SPower: I think these problems may be fixed already in our code base, but it's hard to be sure without a test case. Do you have a scenario where this can be reduced (semi-)reliably? (Also, as bourne suggests, it's best to post to support@greenfoot org with bug reports as it's possible we'll miss them if you post them here in the forums).
SPower SPower

2013/10/14

#
It comes down to something like this:
public class TestWorld extends World
{
    public TestWorld()
    {
        super(400,400,1);
        addObject(new Actor() {
            private int counter = 0;
            public void act() {
                counter++;
                if (counter >= 1000) {
                    getWorld().removeObject(this);
                }
             }
         }, 200, 200);
         Greenfoot.start();
    }
}
danpost danpost

2013/10/14

#
I think this problem (or a related one) was (and still is) encountered in Zamoht's Simple Puzzle Game scenario. Complete the puzzle once and hit 'Reset' and it looks like it is running (but may not be, as per this discussion). Requires 'Pause' and 'Run' to continue.
SPower SPower

2013/10/14

#
I agree with danpost, and want to add something to my last post: then try dragging the actor around, and don't release it, until the actor wants to remove itself.
davmac davmac

2013/10/15

#
I can reproduce this online, but not in Greenfoot itself. Does that match your own experiences?
SPower SPower

2013/10/15

#
Actually it's the reverse: I always had it on greenfoot itself, but never on the website. Do you have a later version of greenfoot than the one I have? I have 2.2.1
davmac davmac

2013/10/15

#
Please - before you report any bug, check with the latest version of Greenfoot. Greenfoot 2.3.0 has been out for a while now.
SPower SPower

2013/10/15

#
Whoops, sorry!
SPower SPower

2013/10/15

#
Just asking, what's actually new in version 2.3, compared to 2.2.1?
bourne bourne

2013/10/15

#
@SPower http://www.greenfoot.org/topics/find/22730#post_22730
There are more replies on the next page.
1
2