Jump to content

BackgroundWorker stopping app closing

Recommended Posts

I have an IOmniBackgroundWork in my application and the application closes normally if I don't use it, but if I add a workitem the app hangs when closing.


The Teardown is as per the examples:



Result := FBackgroundWorker.Terminate(5000);

FBackgroundWorker := Nil;


the result is always False (I have tried varying values for Terminate).


The workitems are always an interfaced object and always get to the OnRequestDone method so I can't understand why Terminate returns false.. I have tried setting the interface to Nil and also not setting it to Nil in the OnRequestDone method.


I think I'm missing something here. Any ideas?





Share this post

Link to post

You are missing a reproducible test case 😉


Sincerely, I have no idea. If the example works for you (you tested it, probably?) and the application doesn't, you'll have to find what that difference is.

  • Like 1

Share this post

Link to post

just working through the code. Given that the Data in the WorkItem is WorkItem.Data.AsInterface = TSomeObject.Create; when would you expect the Object, and the WorkItem to be freed? thanks

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now