[Geany-Devel] On document pointer recycling

Thomas Martitz thomas.martitz at xxxxx
Sun Oct 27 13:11:00 UTC 2013

Am 27.10.2013 12:49, schrieb Nick Treleaven:
> On 26/10/2013 20:29, Matthew Brush wrote:
>> If the GeanyDocument were a GObject (or we added hand-rolled reference
>> counting), the document would never get freed from under the code that
>> uses them's backs.
> My concern is that we might not find all the code that assumes 
> documents aren't freed. Some code might not be updated and would 
> access the wrong memory. I'm not certain, but I think there may be 
> some code that retains pointers without checking is_valid. Maybe I'm 
> being over-cautious.

If that would be the case it is buggy now and will be buggy afterwards.

> Personally I think reference counting would be OTT for this 
> (particularly manually incremented/decremented ref counting), there 
> doesn't seem to be a sensible reason to free document memory IMO.

I agree with Matthew, reference counting seems to be the right tool for 
this job.

Best regards.

More information about the Devel mailing list