Structure.toArray was failing to clear memory when reallocating
memory. I've applied a fix.
On Jul 18, 2007, at 1:00 PM, j impala wrote:
Thank you for fixing this bug. I checked out rev 176. I managed to
boil down one remaining bug to a simple test case, which you may
want to look into:
* JNA type declarations
import com.sun.jna.Structure;
import com.sun.jna.Union;
import com.sun.jna.WString;
public class testClass {
public static class myUnion extends Union {
public long l;
}
public static class otherStruct extends Structure {
public myUnion u;
}
public static class simpleStruct extends Structure {
public WString ws;
public otherStruct o;
}
}
* Java test code
public void testStructure() {
testClass.simpleStruct s = new testClass.simpleStruct();
logger.trace("before simple toArray");
s.toArray(new testClass.simpleStruct[2]);
logger.trace("after simple toArray");
}
(where my logger statements can be replaced by sysouts)
will make the JVM crash. To reproduce the bug, it is necessary that
BOTH WString and a Union be inside simpleStruct.
Thank you.