risoflora / brookframework

Microframework which helps to develop web Pascal applications.
https://risoflora.github.io/brookframework
GNU Lesser General Public License v2.1
233 stars 54 forks source link

In BrookHTTPCookies in Line 278 "VEncoder.Destroy;" do not work under Linux #21

Closed KaitoNakamura closed 3 years ago

KaitoNakamura commented 3 years ago

In Windows the Compiler accept the line 278 "VEncoder.Destroy;" but not the Linux compiler. you need to use Free or DisposeOf here.

[DCC Fehler] BrookHTTPCookies.pas(278): E2362 Auf protected-Symbol TObject.Destroy kann nicht zugegriffen werden

Environment:

OS, compiler and Brook version to reproduce the problem, e.g.:

silvioprog commented 3 years ago

@KaitoNakamura thanks for reporting! Changed to Free as requested and committed in 5.4.4.

KaitoNakamura commented 3 years ago

Hello @silvioprog ,

If you want to be backwards compatible and also support the ARC model, you should use DisposeOf instead of Free. DisposeOf automatically calls Free when not in ARC mode. When calling Free in ARC mode, nothing happens and you get memory leaks. I forgot to mention that. Better you replace all Free calls with DisposeOf.

silvioprog commented 3 years ago

Hi @KaitoNakamura. The project must compile in FPC too, which doesn't provide a DisposeOf() method.

KaitoNakamura commented 3 years ago

As an idea use in addition {$IFDEF AUTOREFCOUNT} DisposeOf {$ENDIF}