In order to simulate an expanding object, I am swapping out the geoms of a body fairly quickly. The effect looks good, but it’s causing a variety of internal errors and crashes.
This is how I’m trying to do it:
PlaceableGeom geo = (PlaceableGeom)this.sim_body.getGeom();
space.remove(geo);
this.sim_body.removeGeom(geo);
geo.delete();
geo = new GeomSphere((float)(this.bounds.getWidth()+22)/2);
this.sim_body.addGeom(geo);
space.addBodyGeoms(this.sim_body);
It causes the following “ODE Internal Error 2” message:
Bad argument(s) (ode/src/collision_space.cpp:182)
and when that doesn’t happen, I get a message like this:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0317e6f1, pid=4356, tid=3724
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode, sharing)
# Problematic frame:
# C [odejava.dll+0x6e6f1]
#
--------------- T H R E A D ---------------
Current thread (0x02d62850): JavaThread "AWT-EventQueue-0" [_thread_in_native, id=3724]
siginfo: ExceptionCode=0xc0000005, writing address 0x00000004
Registers:
EAX=0x031a13f0, EBX=0x031a0650, ECX=0x00000000, EDX=0x031b322c
ESP=0x02f8f35c, EBP=0x02f8f37c, ESI=0xffffffff, EDI=0x47b3b693
EIP=0x0317e6f1, EFLAGS=0x00010246
Top of Stack: (sp=0x02f8f35c)
0x02f8f35c: 02d62850 00000040 26bee1f8 02d91038
0x02f8f36c: 00000050 031a1534 00000000 00000000
0x02f8f37c: 02f8f3a8 0317acc3 031a0650 26bee1f8
0x02f8f38c: 0317ac94 00000040 0317ac81 00000040
0x02f8f39c: 00000000 0313e6b9 00000040 02f8f3b8
0x02f8f3ac: 031119f2 00000040 031b3140 02f8f400
0x02f8f3bc: 03173909 031b3430 00000000 00ad826f
0x02f8f3cc: 02d6290c 02f8f408 031b3160 00000000
Instructions: (pc=0x0317e6f1)
0x0317e6e1: 04 eb 03 8b 5d 08 8b 4a 08 8b 7a 04 83 7d f8 00
0x0317e6f1: 89 79 04 8b 4a 04 8b 7a 08 89 79 08 0f 84 94 00
Stack: [0x02f50000,0x02f90000), sp=0x02f8f35c, free space=252k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [odejava.dll+0x6e6f1]
C [odejava.dll+0x6acc3]
C [odejava.dll+0x19f2]
C [odejava.dll+0x63909]
j org.odejava.ode.Ode.dGeomSetBody(Lorg/odejava/ode/SWIGTYPE_p_dGeomID;Lorg/odejava/ode/SWIGTYPE_p_dBodyID;)V+8
j org.odejava.PlaceableGeom.setBody(Lorg/odejava/Body;)V+111
j org.odejava.Body.removeGeom(Lorg/odejava/PlaceableGeom;)V+38
j Marble.updateSim(Lorg/odejava/World;Lorg/odejava/Space;Lorg/odejava/display/DisplayBin;)V+16
j Sim.marbleUpdated(LSimObject;)V+13
j MarbleStore.refresh(LSimObject;)V+34
j MarbleStore.simObjectChange(LSimObject;Ljava/util/List;Z)V+6
j Marble.fireChangeEvent(Z)V+34
j Marble.resize(DD)V+52
j FaceMarble.paint(Ljava/awt/Graphics2D;Ljava/awt/geom/Rectangle2D;)V+67
j DrawTest$MyPanel.paintComponent(Ljava/awt/Graphics;)V+91
j javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+260
j javax.swing.JComponent.paintWithOffscreenBuffer(Ljavax/swing/JComponent;Ljava/awt/Graphics;IIIILjava/awt/Image;)V+174
j javax.swing.JComponent.paintDoubleBuffered(Ljavax/swing/JComponent;Ljava/awt/Component;Ljava/awt/Graphics;IIII)Z+131
j javax.swing.JComponent._paintImmediately(IIII)V+739
j javax.swing.JComponent.paintImmediately(IIII)V+83
j javax.swing.RepaintManager.paintDirtyRegions()V+314
j javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run()V+32
j java.awt.event.InvocationEvent.dispatch()V+47
j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+26
j java.awt.EventDispatchThread.pumpOneEventForHierarchy(ILjava/awt/Component;)Z+200
j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+26
j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j java.awt.EventDispatchThread.run()V+9
v ~StubRoutines::call_stub
V [jvm.dll+0x8176e]
V [jvm.dll+0xd481d]
V [jvm.dll+0x8163f]
V [jvm.dll+0x8139c]
V [jvm.dll+0x9c05c]
V [jvm.dll+0xfeece]
V [jvm.dll+0xfee9c]
C [MSVCRT.dll+0x2a3b0]
C [kernel32.dll+0xb50b]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.odejava.ode.OdeJNI.dGeomSetBody(JJ)V+0
j org.odejava.ode.Ode.dGeomSetBody(Lorg/odejava/ode/SWIGTYPE_p_dGeomID;Lorg/odejava/ode/SWIGTYPE_p_dBodyID;)V+8
j org.odejava.PlaceableGeom.setBody(Lorg/odejava/Body;)V+111
j org.odejava.Body.removeGeom(Lorg/odejava/PlaceableGeom;)V+38
j Marble.updateSim(Lorg/odejava/World;Lorg/odejava/Space;Lorg/odejava/display/DisplayBin;)V+16
j Sim.marbleUpdated(LSimObject;)V+13
j MarbleStore.refresh(LSimObject;)V+34
j MarbleStore.simObjectChange(LSimObject;Ljava/util/List;Z)V+6
j Marble.fireChangeEvent(Z)V+34
j Marble.resize(DD)V+52
j FaceMarble.paint(Ljava/awt/Graphics2D;Ljava/awt/geom/Rectangle2D;)V+67
j DrawTest$MyPanel.paintComponent(Ljava/awt/Graphics;)V+91
j javax.swing.JComponent.paint(Ljava/awt/Graphics;)V+260
j javax.swing.JComponent.paintWithOffscreenBuffer(Ljavax/swing/JComponent;Ljava/awt/Graphics;IIIILjava/awt/Image;)V+174
j javax.swing.JComponent.paintDoubleBuffered(Ljavax/swing/JComponent;Ljava/awt/Component;Ljava/awt/Graphics;IIII)Z+131
j javax.swing.JComponent._paintImmediately(IIII)V+739
j javax.swing.JComponent.paintImmediately(IIII)V+83
j javax.swing.RepaintManager.paintDirtyRegions()V+314
j javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run()V+32
j java.awt.event.InvocationEvent.dispatch()V+47
j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+26
j java.awt.EventDispatchThread.pumpOneEventForHierarchy(ILjava/awt/Component;)Z+200
j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+26
j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j java.awt.EventDispatchThread.run()V+9
v ~StubRoutines::call_stub
Any ideas? I’ve tried reordering statements and such to no avail.