adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] Re: Loading/saving engine state


From: Kai Sterker
Subject: [Adonthell-devel] Re: Loading/saving engine state
Date: Fri, 25 Sep 2009 23:59:29 +0200

On Mon, Sep 21, 2009 at 8:37 PM, Kai Sterker <address@hidden> wrote:

> As of yesterday, all code has been committed.
[...]
> However, it is not well tested yet, so this will be something to work
> on today.

Took me nearly a week to figure out a segfault I was getting in
serializertest.py :-(. Turns out that the serializer object was
deleted by Python, after being passed to the savegame manager.
Accessing it afterwards then caused the crash.

I fixed this behaviour using a typemap in the SWIG interface, but in
general there is the question how to handle memory management for the
serializers. Does the savegame stuff take ownership and responsibility
for cleaning up? Or remains ownership with the instances that register
stuff at the savegame manager? Former will be fine if registrations
are (mostly) static, but if we start registering/deregistering
serializers frequently, then ownership should not belong to the
savegame manager.

This requires some additional thoughts ...


Anyway, to try things out, you can do something like:

    python serializertest.py -g . data

The invocation is getting a bit complicated, as I changed the engine
initialization routine to exit if it does not find the builtin or a
user-supplied data directory. Plus, the savegame stuff will only be
initialized properly if a game name is given ... in this case it's
'data'.

Feel free to experiment a bit with serializertest.py too. The
underlying code should be pretty solid by now, but there might still
be issues left.

Cheers,

Kai




reply via email to

[Prev in Thread] Current Thread [Next in Thread]