[Kde-imaging] Ownership policy
Jesper K. Pedersen
blackie at blackie.dk
Fri Apr 9 08:45:55 CEST 2004
On Friday 09 April 2004 00:54, Aurelien Gateau wrote:
| Hi!
|
| I'm trying to write a real implementation of KIPI::Interface in Gwenview.
| I'm wondering about the ownership policy of currentAlbum() and
| currentSelection(): Should the caller be responsible of deleting it or
| should it be up to the KIPI::Interface implementation? If the second, what
| would be the lifetime of the returned pointer?
I think we came up with this on IRC:
Some applications may simply return a pointer to their own internal
datastructure of the data, while others may make them up. Therefore we can
not hand ownership on to the plugin, as the plugin would delete internal data
of the application.
The lifetime of the data is instead until the function generating the data is
called again. That way you could simply have a static datastructure you
refill for each usage. (This idea is similar to many C library function,
though I can't think of any right now)
| I personally would prefer to let the caller be responsible of it as it
| would simplify the code in the KIPI::Interface implementation and would
| avoid crash if the plugin access the ImageCollection after the host deleted
| it.
Right, that just have the disadvantage that the host application would need to
make a fresh copy each time asked. I don't know if that would be a major
disadvantage to the applications, IIRC Renchi was the one most in favor of
the above scheme.
| PS: I will be away on Sunday (11/4) till next Sunday (18/4). Just so that
| you don't wonder why I don't answer fast :-)
Damn,
I've taken next week off to concentrate sololy on KimDaBa, and on the plugin
structure.
Are there no chance for you to read email?
Cheers
Jesper.
More information about the Kde-imaging
mailing list