Recent

Author Topic: Why VirtualDBTreeEx not cleared at form close?  (Read 991 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1592
Why VirtualDBTreeEx not cleared at form close?
« on: March 27, 2025, 10:36:23 am »
I'm trying VirtualDBTreeEx, but it is not destroyed clearly. I don't think I'm doing anything special. The attached image is the first error message. What could possibly go wrong?

And how can I edit second, third, etc. columns? I can edit only the first column.
« Last Edit: March 27, 2025, 10:49:17 am by egsuh »

jamie

  • Hero Member
  • *****
  • Posts: 6873
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #1 on: March 27, 2025, 05:29:06 pm »
Don't you will get much response since there is so many variables in the situation you left out.

 1. did you create that DB class at runtime?

 2. When closing a form there are many ways, one free's the form! did you forget to free the class you may have created in the onCreate?

 3. Normally closing a for free's it, you need to do some cleanup of any items you created at runtime.
The only true wisdom is knowing you know nothing

egsuh

  • Hero Member
  • *****
  • Posts: 1592
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #2 on: March 28, 2025, 03:36:02 am »
Attached is my program.
Run it, and press "Refresh", which may take a few seconds. It downloads dataset from my web server.
And then terminate the application. Then I see the error messages.

egsuh

  • Hero Member
  • *****
  • Posts: 1592
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #3 on: March 28, 2025, 05:51:28 am »
And how can I change the texts in columns, e.g. for TARGET or MAXN fields? I tried to link DBEdits with the fields and changed the values, but the changes were not reflected in VirtualDBTree.

Zvoni

  • Hero Member
  • *****
  • Posts: 2961
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #4 on: March 28, 2025, 08:28:04 am »
Attached is my program.
Run it, and press "Refresh", which may take a few seconds. It downloads dataset from my web server.
And then terminate the application. Then I see the error messages.
The only thing i see is in TForm1.
You create the Frame, but you don't free it.

Create an OnClose (or whichever event) for Form1 and free the Frame explicitely there
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

egsuh

  • Hero Member
  • *****
  • Posts: 1592
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #5 on: March 28, 2025, 10:20:41 am »
It doesn't matter. I have assigned owner as self.

   frQuota := TfrQuota.Create(self);

and even when I destroyed at FormDestroy,

    frQuota.Free;

the problem does not disappear.

wp

  • Hero Member
  • *****
  • Posts: 12757
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #6 on: March 28, 2025, 12:26:24 pm »
I am pretty sure that the bug is in the TVirtualDBTreeEx code itself: the component create a FParentField, but never destroys it. I can verify this in a simpler demo project which I am attaching (it compiles with the version of the component from the author's site (https://sourceforge.net/p/virtualdbtreeex/code/ci/default/tree/), I don't know whether it compiles with the OPM version).

I contacted the author of the component (matthius).
« Last Edit: April 19, 2025, 01:09:08 pm by wp »

jamie

  • Hero Member
  • *****
  • Posts: 6873
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #7 on: March 28, 2025, 06:59:33 pm »
I am pretty sure that the bug is in the TVirtualDBTreeEx code itself: the component create a FParentField, but never destroys it. I can verify this in a simpler demo project which I am attaching (it compiles with the version of the component from the author's site (https://sourceforge.net/p/virtualdbtreeex/code/ci/default/tree/), I don't know wither it compile with the OPM version).

I contacted the author of the component (matthius).

I had problems compiling your example, had to remove "Laz.Virtual...." and use just the original Package, not the Laz one.

Also at that point I was able to get it to compile and run however, exiting from the app to see the heap trace screen just hangs the debugger and never exits.

So I don't know what to say.

 I am using 3.2 Laz and 3.2.2 Fpc
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 12757
Re: Why VirtualDBTreeEx not cleared at form close?
« Reply #8 on: April 19, 2025, 01:08:42 pm »
I am pretty sure that the bug is in the TVirtualDBTreeEx code itself: the component create a FParentField, but never destroys it. [...]
I contacted the author of the component (matthius).
The current version of the component in OPM does not have the memory leak any more.

 

TinyPortal © 2005-2018