Delphi 12.2 IDE pops up an "Invalid Pointer" error dialog when closing project that uses TAdvPageControl

Delphi 12.2 IDE pops up an "Invalid Pointer" error dialog when closing one of my projects. I spent an hour or so trying to find the culprit. It appears to be with the latest TMS update version 13.4.0.1 (5-Feb-2025). When I reinstalled the previous version 13.4.0.0 (15-Jan-2025), the "Invalid Pointer" error dialog no longer appeared when I closed my project.

Delphi's "Invalid Pointer" error dialog has a details link, which contained the following stack trace. I see some TMS references in the list (my project uses TAdvPageControl):

[5A07FFEC]{rtl290.bpl } System.TObject.FreeInstance (Line 18364, "System.pas" + 2) + $2
[5A07A4D2]{rtl290.bpl } System.ErrorAt (Line 5916, "System.pas" + 3) + $4
[5A07A516]{rtl290.bpl } System.Error (Line 5927, "System.pas" + 1) + $7
[5A07FFEC]{rtl290.bpl } System.TObject.FreeInstance (Line 18364, "System.pas" + 2) + $2
[5A0807B6]{rtl290.bpl } System.@ClassDestroy (Line 19728, "System.pas" + 0) + $2
[60F82DF9]{vcl290.bpl } Vcl.Graphics.TFont.Destroy (Line 2562, "Vcl.Graphics.pas" + 5) + $6
[5A0800E4]{rtl290.bpl } System.TObject.Free (Line 18427, "System.pas" + 1) + $4
[60F841F9]{vcl290.bpl } Vcl.Graphics.TCanvas.Destroy (Line 3924, "Vcl.Graphics.pas" + 4) + $3
[60FAB90C]{vcl290.bpl } Vcl.Controls.TControlCanvas.Destroy (Line 5542, "Vcl.Controls.pas" + 2) + $6
[5A0800E4]{rtl290.bpl } System.TObject.Free (Line 18427, "System.pas" + 1) + $4
[60FBB149]{vcl290.bpl } Vcl.Controls.TCustomControl.Destroy (Line 15209, "Vcl.Controls.pas" + 1) + $6
[5A0800E4]{rtl290.bpl } System.TObject.Free (Line 18427, "System.pas" + 1) + $4
[5A0C7F14]{rtl290.bpl } System.SysUtils.FreeAndNil (Line 28385, "System.SysUtils.pas" + 2) + $2
[207F25E1]{TMSVCLUIPackPkgDXE15.bpl} Advcustomcomponent.TAdvCustomComponent + $11
[209C483F]{TMSVCLUIPackPkgDXE15.bpl} Advpdfio.TAdvCustomPDFIO + $27
[60FB152E]{vcl290.bpl } Vcl.Controls.TWinControl.Destroy (Line 9318, "Vcl.Controls.pas" + 25) + $6
[5A0807B6]{rtl290.bpl } System.@ClassDestroy (Line 19728, "System.pas" + 0) + $2
[60FBB154]{vcl290.bpl } Vcl.Controls.TCustomControl.Destroy (Line 15210, "Vcl.Controls.pas" + 2) + $6
[20DB179C]{TMSVCLUIPackPkgDXE15.bpl} Advpagecontrol.TAdvTabSheet + $38
[60FB152E]{vcl290.bpl } Vcl.Controls.TWinControl.Destroy (Line 9318, "Vcl.Controls.pas" + 25) + $6
[5A0807B6]{rtl290.bpl } System.@ClassDestroy (Line 19728, "System.pas" + 0) + $2
[6101FBC9]{vcl290.bpl } Vcl.ComCtrls.TCustomTabControl.Destroy (Line 6014, "Vcl.ComCtrls.pas" + 5) + $6
[20DB238B]{TMSVCLUIPackPkgDXE15.bpl} Advpagecontrol.TAdvPageControl + $DF
[60FB152E]{vcl290.bpl } Vcl.Controls.TWinControl.Destroy (Line 9318, "Vcl.Controls.pas" + 25) + $6
[5A0807B6]{rtl290.bpl } System.@ClassDestroy (Line 19728, "System.pas" + 0) + $2
[60FBB154]{vcl290.bpl } Vcl.Controls.TCustomControl.Destroy (Line 15210, "Vcl.Controls.pas" + 2) + $6
[20DB179C]{TMSVCLUIPackPkgDXE15.bpl} Advpagecontrol.TAdvTabSheet + $38
[60FB152E]{vcl290.bpl } Vcl.Controls.TWinControl.Destroy (Line 9318, "Vcl.Controls.pas" + 25) + $6
[5A0807B6]{rtl290.bpl } System.@ClassDestroy (Line 19728, "System.pas" + 0) + $2
[6101FBC9]{vcl290.bpl } Vcl.ComCtrls.TCustomTabControl.Destroy (Line 6014, "Vcl.ComCtrls.pas" + 5) + $6
[20DB238B]{TMSVCLUIPackPkgDXE15.bpl} Advpagecontrol.TAdvPageControl + $DF
[60FB152E]{vcl290.bpl } Vcl.Controls.TWinControl.Destroy (Line 9318, "Vcl.Controls.pas" + 25) + $6
[5A0807B6]{rtl290.bpl } System.@ClassDestroy (Line 19728, "System.pas" + 0) + $2
[610F280F]{vcl290.bpl } Vcl.Forms.TScrollingWinControl.Destroy (Line 3433, "Vcl.Forms.pas" + 3) + $6
[610F74A5]{vcl290.bpl } Vcl.Forms.TCustomForm.Destroy (Line 5502, "Vcl.Forms.pas" + 31) + $A
[62360348]{designide290.bpl} Proxies.DestroyHook (Line 388, "Proxies.pas" + 2) + $6
[5A0800E4]{rtl290.bpl } System.TObject.Free (Line 18427, "System.pas" + 1) + $4
[74405DE2]{vcldesigner290.bpl} VCLFormDesigner.TVCLRootDesigner.FreeRoot (Line 581, "VCLFormDesigner.pas" + 0) + $2
[62394EDB]{designide290.bpl} ComponentDesigner.TComponentRoot.InternalDeinitializeDesigner (Line 5106, "ComponentDesigner.pas" + 24) + $B
[62397BB5]{designide290.bpl} ComponentDesigner.TComponentRoot.Close (Line 6050, "ComponentDesigner.pas" + 5) + $5
[590BAEBC]{delphicoreide290.bpl} DelphiModule.TPascalCodeMgrModHandler.Destroyed (Line 755, "DelphiModule.pas" + 11) + $5
[59806F49]{coreide290.bpl} DocModul.TCodeIDocModule.NotifyDestroyed (Line 2521, "DocModul.pas" + 2) + $5
[6237037C]{designide290.bpl} ToolUtils.ForEach (Line 124, "ToolUtils.pas" + 9) + $F
[59806EBA]{coreide290.bpl} DocModul.TCodeIDocModule.NotifyDestruction (Line 2505, "DocModul.pas" + 2) + $B
[59803DA0]{coreide290.bpl} DocModul.TDocModule.BeforeDestruction (Line 1065, "DocModul.pas" + 16) + $0
[5A080815]{rtl290.bpl } System.@BeforeDestruction (Line 19768, "System.pas" + 10) + $0
[595DBF5A]{coreide290.bpl} SourceModule.TSourceModule.Destroy (Line 441, "SourceModule.pas" + 0) + $2
[5A0800E4]{rtl290.bpl } System.TObject.Free (Line 18427, "System.pas" + 1) + $4
[598050BE]{coreide290.bpl} DocModul.WalkDependencies (Line 1713, "DocModul.pas" + 9) + $2
[59805109]{coreide290.bpl} DocModul.TDocModule.WalkDependencies (Line 1722, "DocModul.pas" + 1) + $1
[59804102]{coreide290.bpl} DocModul.TDocModule.Close (Line 1178, "DocModul.pas" + 13) + $F
[59542A65]{coreide290.bpl} ProjectModule.TBaseProject.BeforeDestruction (Line 1122, "ProjectModule.pas" + 37) + $6
[59026E21]{delphicoreide290.bpl} BaseDelphiProject.TBaseDelphiProject.BeforeDestruction (Line 4484, "BaseDelphiProject.pas" + 4) + $2
[5A080815]{rtl290.bpl } System.@BeforeDestruction (Line 19768, "System.pas" + 10) + $0
[59010A4F]{delphicoreide290.bpl} BaseDelphiProject.TBaseDelphiProject.Destroy (Line 988, "BaseDelphiProject.pas" + 0) + $3
[5A0800E4]{rtl290.bpl } System.TObject.Free (Line 18427, "System.pas" + 1) + $4
[594991C4]{coreide290.bpl} ProjectGroup.TProjectGroup.BeforeDestruction (Line 968, "ProjectGroup.pas" + 52) + $2
[5A080815]{rtl290.bpl } System.@BeforeDestruction (Line 19768, "System.pas" + 10) + $0
[59498F22]{coreide290.bpl} ProjectGroup.TProjectGroup.Destroy (Line 901, "ProjectGroup.pas" + 0) + $2
[5A0800E4]{rtl290.bpl } System.TObject.Free (Line 18427, "System.pas" + 1) + $4
[5949F90A]{coreide290.bpl} ProjectGroup.TProjectGroupWrapper.Close (Line 2848, "ProjectGroup.pas" + 2) + $5
[007B8281]{bds.exe } AppMain.TAppBuilder.DestroyProjectGroup + $1A9
[007B83DC]{bds.exe } AppMain.TAppBuilder.CloseProjectGroup + $54
[007B92CE]{bds.exe } AppMain.TAppBuilder.FileCloseAll + $A6
[5A1A400B]{rtl290.bpl } System.Classes.TBasicAction.Execute (Line 18584, "System.Classes.pas" + 3) + $7
[60F93752]{vcl290.bpl } Vcl.ActnList.TCustomAction.Execute (Line 284, "Vcl.ActnList.pas" + 19) + $35
[5A1A3DBD]{rtl290.bpl } System.Classes.TBasicActionLink.Execute (Line 18479, "System.Classes.pas" + 8) + $7
[74FB6879]{vclactnband290.bpl} Vcl.ActnMenus.TCustomActionMenuBar.ExecAction (Line 1103, "Vcl.ActnMenus.pas" + 6) + $D
[74FB8138]{vclactnband290.bpl} Vcl.ActnMenus.TCustomActionMenuBar.TrackMenu (Line 1873, "Vcl.ActnMenus.pas" + 19) + $15
[74FBBEB6]{vclactnband290.bpl} Vcl.ActnMenus.TCustomActionMainMenuBar.TrackMenu (Line 3839, "Vcl.ActnMenus.pas" + 5) + $3
[74FB63F4]{vclactnband290.bpl} Vcl.ActnMenus.TCustomActionMenuBar.CMItemClicked (Line 973, "Vcl.ActnMenus.pas" + 2) + $11
[74FB63FD]{vclactnband290.bpl} Vcl.ActnMenus.TCustomActionMenuBar.CMItemClicked (Line 974, "Vcl.ActnMenus.pas" + 3) + $4
[60FAF15E]{vcl290.bpl } Vcl.Controls.TControl.WndProc (Line 7920, "Vcl.Controls.pas" + 91) + $6
[60FB4813]{vcl290.bpl } Vcl.Controls.TWinControl.WndProc (Line 11154, "Vcl.Controls.pas" + 178) + $6
[60FAED94]{vcl290.bpl } Vcl.Controls.TControl.Perform (Line 7698, "Vcl.Controls.pas" + 10) + $8
[60FB469F]{vcl290.bpl } Vcl.Controls.TWinControl.WndProc (Line 11102, "Vcl.Controls.pas" + 126) + $1D
[60FB4813]{vcl290.bpl } Vcl.Controls.TWinControl.WndProc (Line 11154, "Vcl.Controls.pas" + 178) + $6
[5A081090]{rtl290.bpl } System.TMonitor.TryEnter (Line 20364, "System.pas" + 10) + $0
[5A080BB0]{rtl290.bpl } System.TMonitor.Enter (Line 20025, "System.pas" + 4) + $2
[5A080A18]{rtl290.bpl } System.TMonitor.CheckOwningThread (Line 19939, "System.pas" + 2) + $0
[5A080D3E]{rtl290.bpl } System.TMonitor.Exit (Line 20129, "System.pas" + 1) + $2
[74FB8274]{vclactnband290.bpl} Vcl.ActnMenus.TCustomActionMenuBar.WndProc (Line 1917, "Vcl.ActnMenus.pas" + 25) + $4
[60FB3CD8]{vcl290.bpl } Vcl.Controls.TWinControl.MainWndProc (Line 10823, "Vcl.Controls.pas" + 3) + $6
[5A1A4E3C]{rtl290.bpl } System.Classes.StdWndProc (Line 19091, "System.Classes.pas" + 8) + $0
[611047BB]{vcl290.bpl } Vcl.Forms.TApplication.ProcessMessage (Line 13376, "Vcl.Forms.pas" + 23) + $1
[611047FE]{vcl290.bpl } Vcl.Forms.TApplication.HandleMessage (Line 13406, "Vcl.Forms.pas" + 1) + $4
[61104B3D]{vcl290.bpl } Vcl.Forms.TApplication.Run (Line 13545, "Vcl.Forms.pas" + 27) + $3
[00808B02]{bds.exe } bds.bds + $DE

On a side note, I have another computer with the same development setup (Delphi 12, 2, TMS VCL, etc.). On that other computer, which also popped up the "Invalid Pointer" dialog, its stack trace did NOT have any TMS references. But nonetheless, reinstalling the previous version 13.4.0.0 fixed the issue. (i.e., closing the project no longer popped up the "Invalid Pointer" dialog.)

I hope it's an easy bug fix at your end! If you need further info, let me know.

Steve V

If it matters, one of my TAdvTabSheet controls contains a reusable TFrame component that's dropped into the form from the Component Palette "Templates" section.

I checked this here and in TAdvPageControl/TAdvTabSheet, there have not been any changes between v13.4.0.0 and v13.4.0.1.
I also see a reference to AdvPDFIO unit, but also in this unit, we did not do any changes.
Is there a way we can reproduce this here so we can investigate?

If I have time, I'll have to reinstall 13.4.0.1 and strip away, layer by layer, various elements of a rather large project to pinpoint the culprit. My reference to TAdvPageControl/TAdvTabSheet was just a hunch, based on what was in that stack trace. But like I said, the Delphi-reported stack trace on my other computer did not show any TMS references, but still popped up the "Invalid Pointer" on project close. Reverting back to 13.4.0.0 fixed the issue on both computers.

So, this is a perplexing issue. I'll see what I can do. But if the next update (in 3-4 weeks?) doesn't exhibit this behavior, I'll just forget about it. :slight_smile:

OK, please let us know if you have more details

Well, this took a whole day of whittling away my large project to find the culprit (TAdvGraphicsPDFIO). I then created a test case that you can work with. Details are explained in the form. Four files are attached. I'm using Delphi 12.2 with TMS VCL 13.4.0.1.

(Also note the question I have about the missing "Add Page" option when right-clicking the TAdvPageControl component.)

Steve Vinson

ShutdownBug.dpr (257 Bytes)
ShutdownBug.dproj (57.4 KB)
ShutdownBugUnit.dfm (22.1 KB)
ShutdownBugUnit.pas (814 Bytes)

Thanks for these details.
I have investigated this but I could not reproduce this problem (I tested this in Delphi 12.2 but also Delphi 10.2) and I also checked that there are no code changes between TMS VCL UI Pack 13.4.0.0 and 13.4.0.1 and I do not see any code changes in the area of AdvGraphicsPDFIO.
Now, this component is designed as a pseudo visual component. The reason for this is that this is actually generated from the TTMSFNCGraphcisPDFIO and as FNC components have to be able to be used both in VCL form designer and FMX form designer and have to be installed for both frameworks at the same time, these need to be build on top of the control's framework. Other than this small annoyance that it can be as such a child of another control at design-time, there should be no other side effects.
For the problem, I can't help but thinking that you do not have a clean install of the latest TMS VCL UI Pack, i.e. that there is perhaps a mix of 13.4.0.0 binaries (BPL, DCP, DCU) & 13.4.0.1 binaries. I suggest to uninstall, scan your full hard disk for all TMS VCL UI Pack related binaries and ensure all are removed and then reinstall.
That will most likely also address the issue with the design-time package that does not appear to be active. See IDE menu : Component, Install Packages and make sure the package "TMS VCL UI Pack design time support" is listed and active (checked)

Fwiw, my test was based on our latest internal build and that might already have improvements that mask this issue. So, I would suggest to check with the next release too.

FYI, the Invalid Pointer when closing a project that has a TAdvGraphicsPDFIO component inadvertently dropped into the confines of a TDBAdvGrid is FIXED in the latest TMS VCL 13.4.1.0 released on 21-Feb-2025. This was proven when running the sample project (ShutDownBug.dpr) I gave you in a prior post.

On a side note, for the past two TMS VCL versions, I came across a compiler hint on an unused variable in your AdvGrid unit. An easy fix, but I thought you would have seen it by now. Image attached.

Just found two others (the kid left the room):

The hint in AdvMenus.pas I could see & fix.
The AdvGrid.pas you show seems old code as this variable de is not longer there in our latest release.

Regarding AdvGrid.pas, that's perplexing to me. No errors were reported when I ran the latest update, so I thought I had the latest source code throughout.

Thanks for the feedback.