Re: [anjuta-devel] New project interface and introspection
- From: Sébastien Granjoux <seb sfo free fr>
- To: Abderrahim Kitouni <a kitouni gmail com>
- Cc: anjuta-devel-list gnome org
- Subject: Re: [anjuta-devel] New project interface and introspection
- Date: Mon, 06 Sep 2010 20:59:43 +0200
Hi,
Le 06/09/2010 19:07, Abderrahim Kitouni a écrit :
You did add allow-none for the file, right? (still It seems weird it
didn't complain about passing 0 instead of an enum value)
Yes I have allow-node for the file and 0 was a valid valid for this enum.
pointer = Anjuta.project_generic_node_get_user_data (node)
But pointer is gi.FunctionInfo, how can I convert it back to NodeData ?
Well, you've probably hit a bug in PyGObject. Do you have some code I
can try?
I don't think it is a bug as PyGObject has no way to know the type of
the returned data (it is a generic pointer). So I think you have to
specify the type of the object in the caller code. In C, it would be a
type casting but python work a bit differently.
Ok, I have just committed it (commit
752247578cb45d7dc6a6cfe375d6811f94f36d4e). It is just temporary for
checking bindings. I should have done it in separate file but as it is
in branch, I think it doesn't matter that much.
Do you know how I can be sure that the free function is called ?
It should be called when there are no more refernces to the object,
neither from python nor from C. It may help to run the gc.
It is not called. I have tried to run gc.collect but it doesn't change
anything.
I think you shouldn't worry about this, if there is no reference leak it
should be freed at some point.
If the point is at the end of program it looks exactly like a memory leak.
I have read that the free function is not always called. This cannot be
done when the program ends because python doesn't know in which order
free all items, so all memory is free by the OS when the process end.
It's faster, but you cannot guarantee that the destructor is called.
I think that a free function is better to avoid memory leak.
Regards,
Sébastien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]