jacob-carlborg/orange

Segfaulting

jcd opened this issue · 7 comments

jcd commented

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);

}

I would need some information about your environment. D1 or D2, Phobos or Tango? Which version of DMD (or if it's GDC or LDC) and on which platform?

The above example is working fine for me using DMD 2.057 and 1.072.

OK, this appears to be a problem with the DMD 2.058 beta.

jcd commented

Yes D2 2.058 beta and phobos. Is it a dmd bug or a orange bug then?

That's what I'm trying to figure out. But it work with DMD 2.057.

Fixed in 91582abc6d588f418a9540197838de7b337a4df5. It turned out to be a problem with my code.

jcd commented

ok thx