[Qt] Some moments with commit 11541 (Fxed ugly memleak with TQtImage)

zeljko zeljko at holobit.net
Tue Jul 17 14:48:36 CEST 2007


On Tuesday 17 July 2007 12:32, Павел Ишенин wrote:
> Hello, Items specific to the Qt widget set
>
> Can I advance a remark about commit?
>
> If so, then I will do :)

yep ;)

>
> To be closer with other lazarus sources and internal rules I want to
> comment some aspects of patch.
>
> First of all - naming:
>
> class fields usually starts with letter F while arguments with letter A, so
> ACreateData: PByte; ADispose: Boolean; better to write as
> FData: PByte; FDataOwner: Boolean;
>
> also CreateData tell us that this is someting data that either we want
> to create or ... I dont know :) FData is more general. ADispose tell us
> nothing about what to Dispose while FDataOwner tell us then TQtImage is
> Owner of FData.

ok

> Second problem - destructor.
>
> If we allocated memory with GetMem / AllocMem then we must free it with
> FreeMem while if we allocated memory with New then we must use Dispose.
>
> So, I changed Dispose to FreeMem.
>
> I attached patch. I have not checked it compilation I only edited source
> file in text editor. So, please test it and better apply.
>
> I cant force you to use suggested fields names (better to use - it will
> be easier to read code later), but FreeMem should be use instead of
> Dispose.
>
> And at last - sorry for grumbling :)

I've tried with FreeMem(), but it won't compile (probably my typo), so I 
change it to Dispose() just to test, and then forgot to fix it ;)

tnx for the patch :)




More information about the Qt mailing list