Re: [fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

2016-10-17 Thread grouchysmurf
Hi. >> I ended up doing exactly that though it feels like an ugly thoug[h] >> incomplete hack. Thanks for the tip. > Why a hack? > System.ExitCode is meant for returning exitcodes. Being forced to forfeit one or two layers of abstraction in an object oriented environment does sound like a hack

Re: [fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

2016-10-16 Thread grouchysmurf
> Probably you can set system.ExitCode before calling Terminate. I ended up doing exactly that though it feels like an ugly thoug incomplete hack. Thanks for the tip. Ɓukasz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

2016-10-13 Thread grouchysmurf
Hi. > Anyway, I think that when the application is closed all the allocated > memory is freed, memory leaks survive as long as the application is > running. So wondering about what's in memory after a halt makes no > sense, everything is freed. I am not very familiar with internals of system

Re: [fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

2016-10-13 Thread grouchysmurf
Hi. > I would also rewrite that with a try..finally as in: Thanks. This is what I am planning to do eventually but as for now I am learning the ropes -- freepascal is kind of new to me and I am slowly learning its new features. Last Pascal I've been programming in was TP 6.0 with

Re: [fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

2016-10-13 Thread grouchysmurf
Hi. > Call Terminate and exit properly ? > TCustomApplication has an exitcode property which will set the global exit > code. This feature either undocumented or I am just too stupid to find it. Mind if I ask you to point me directly to the documentation? I believe it would have to be something

[fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

2016-10-13 Thread grouchysmurf
Hi. Is there a way to pre-maturely halt TCustomApplication without causing memory leaks? Say, I have a code, where TH is a Class(TCustomApplication): ph := TH.Create(Nil); ph.Initialize; ph.ProcessOptions; ph.Run; ph.Free; When options are processed, it may happen the program needs