Re: [fpc-devel] FreeInstance

2018-08-01 Thread Ryan Joseph
> On Aug 1, 2018, at 3:28 PM, Sven Barth via fpc-devel > wrote: > > If you'd look at the code you quoted you'd see that this is only inserted > *inside* a destructor (the check for potype_destructor; current_procinfo is > the currently compiled routine). So, no, your code is not enough. You

Re: [fpc-devel] FreeInstance

2018-08-01 Thread Ben Grasset
Forgot to mention a record or object with at least one method will get to the first part also, but never the FreeInstance part as they can never have destructors. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org

Re: [fpc-devel] FreeInstance

2018-08-01 Thread Ben Grasset
> On Wed, Aug 1, 2018 at 11:27 AM, Ryan Joseph wrote: > Yeah, this is the first place I looked but current_structdef is always nil so it never progresses past that point. > Is this test program not enough to get FreeInstance called? You need to declare a class, and give that class at least one

Re: [fpc-devel] FreeInstance

2018-08-01 Thread Ben Grasset
> I’m still trying to find this with no luck. Doing a quick search for the word "freeinstance" in the compiler source shows two places where it looks for a member function with that name in the global "current_structdef" variable. I'm fairly certain the one you're looking for is in a function

Re: [fpc-devel] FreeInstance

2018-08-01 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Mi., 1. Aug. 2018, 17:28: > > > > On Aug 1, 2018, at 9:17 AM, Sven Barth via fpc-devel < > fpc-devel@lists.freepascal.org> wrote: > > > > Search the compiler's source for the string 'FREEINSTANCE'; you'll find > two locations, one in ngenutil and one in psub. The latter is

Re: [fpc-devel] FreeInstance

2018-08-01 Thread Ryan Joseph
> On Aug 1, 2018, at 9:17 AM, Sven Barth via fpc-devel > wrote: > > Search the compiler's source for the string 'FREEINSTANCE'; you'll find two > locations, one in ngenutil and one in psub. The latter is the one you want. > Yeah, this is the first place I looked but current_structdef is

Re: [fpc-devel] FreeInstance

2018-08-01 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Di., 31. Juli 2018, 22:29: > > > > On Jul 31, 2018, at 9:56 AM, Ryan Joseph > wrote: > > > > then how does it get invoked then? there must be some node added > somewhere but I can’t find it. > > I’m still trying to find this with no luck. I suspect there’s a call node >

Re: [fpc-devel] FreeInstance

2018-07-31 Thread Ryan Joseph
> On Jul 31, 2018, at 9:56 AM, Ryan Joseph wrote: > > then how does it get invoked then? there must be some node added somewhere > but I can’t find it. I’m still trying to find this with no luck. I suspect there’s a call node added when the compiler detects a destructor was called (maybe in

Re: [fpc-devel] FreeInstance

2018-07-31 Thread Ryan Joseph
> On Jul 31, 2018, at 9:48 AM, Thorsten Engler wrote: > > I don't think it's called anywhere in the source. It's called by the compiler > after the destructor has finished. The same way that InitInstance is run > before the constructor is called. then how does it get invoked then? there

Re: [fpc-devel] FreeInstance

2018-07-31 Thread Thorsten Engler
August 2018 01:36 > To: FPC developers' list > Subject: [fpc-devel] FreeInstance > > Looking at the FPC source now and it appears FreeInstance is a > hidden method which is not called from the TObject destructor. > > Where/how is this method called in the source? I’ve been i

[fpc-devel] FreeInstance

2018-07-31 Thread Ryan Joseph
Looking at the FPC source now and it appears FreeInstance is a hidden method which is not called from the TObject destructor. Where/how is this method called in the source? I’ve been in the debugger for over an hour and I still can’t find it. Regards, Ryan Joseph