Git Product home page Git Product logo

Comments (5)

joachimmarder avatar joachimmarder commented on June 26, 2024

What exactly make you think that the thread of Virtual TreeView causes the crash?

from virtual-treeview.

Dzyszla avatar Dzyszla commented on June 26, 2024

I attach demo code (two projects: exe and dll):
VST_Test.zip

On my computer have no errors, but when I run it on Windows 2012/2016/2019 Server, click button and close window (by shortcut, by mouse click - no matter) in 1 on 10 times crash (but sometime can be 10 times without error, and next every 3 run and close ends with crash).
here attach system logs:
VSTerrors.zip

from virtual-treeview.

Dzyszla avatar Dzyszla commented on June 26, 2024

PS - When I made changes in dispose method, then works good:

class procedure TWorkerThread.Dispose(CanBlock: Boolean);
var
  LRef: TThread;
begin
  WorkerThread.FreeOnTerminate := False;   // << NEVR USE FREE ON TERMINATE
  //WorkerThread.FreeOnTerminate := not CanBlock;  // << -- " --
  WorkerThread.Terminate();
  SetEvent(WorkerThread.FWorkEvent);
  LRef := WorkerThread;
  WorkerThread.WaitFor; // << ADD WAITING  FOR TERMINATE
  WorkerThread := nil; //Will be freed usinf TThread.FreeOnTerminate
  //if CanBlock then   << DISABLE THIS LINE - OBJECT MUST BE ALWAYS FREE
	LRef.Free;
end;

from virtual-treeview.

joachimmarder avatar joachimmarder commented on June 26, 2024

I didn't get a single crash in 30 tries with your demo project.

Can you please check if the following change makes any difference in your case: In TBaseVirtualTree.Destroy() change the call to TWorkerThread.ReleaseThreadReference to:

TWorkerThread.ReleaseThreadReference(IsLibrary);

from virtual-treeview.

Dzyszla avatar Dzyszla commented on June 26, 2024

I try my demo on my own system, and it's crash after about 1 on 60-80 trials (very infrequently, but possible). I think, it depends on cpu cores load.

I made the changes as suggested (and I rolled back my own previous changes) and looks all right - no more crashes.

from virtual-treeview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.