imageclone fix leaks when tile and/or brush are set.#884
Conversation
those are cloned themselves which make things complicated to track to release manually thus taking care of cloned parts internally.
|
I believe this might cause some troubles if the cloned image brush/tile are later set to a new image. The only really clean solution I can think of is to clone the tiles and brushes (non recursively) on set and always free them on image destroy. |
Right. And what happens if a tile/brush is set on an image, but the tile/brush is destroyed? Do we consider this a programmer error? And what happens if the same image is set as tile and brush?
Alternatively it should be possible to implement ref-counting for images. That might break some client's expectations, though (e.g. Given that libgd is relatively low-level, it might be better to not change its behavior, but to adapt consumers (e.g. PHP). |
those are cloned themselves which make things complicated to track to release manually thus taking care of cloned parts internally.