jacob-carlborg/orange — Issue #8: Segfaulting
Author: jcd
Created: 2012-02-12 19:27:35+00:00
State: open

I tried to extend the default example a bit and get a segfault:

import orange.core._;
import orange.serialization._;
import orange.serialization.archives._;

class Foo
{
int a;
Foo refme;
}

void main ()
{
auto foo = new Foo; // create something to serialize
foo.a = 3; // change the default value of "a"
auto foo2 = new Foo; // create something to serialize
foo2.a = 42;
foo.refme = foo2;

auto archive = new XmlArchive!(char); // create an XML archive
auto serializer = new Serializer(archive); // create the serializer

serializer.serialize(foo); // serialize "foo"

// deserialize the serialized data as an instance of "Foo"
auto f = serializer.deserialize!(Foo)(archive.untypedData);

// verify that the deserialized value is equal to the original value
assert(f.a == foo.a);
}