Jump to content
dkprojektai

Very strange issue, Thread exits without any notice

Recommended Posts

Hello, I made some software in which on thread exception program exits(terminates) without any notice. What I do..

 

Make thread...
 

  FThread := TWorkerThread.Create(true);
  FThread.FreeOnTerminate := true;
  FThread.Start;



After, I work with dll in it...
 

try
              
   Try

       raise Exception.Create('Test Exception'); ----<<<< if here, no problem

       candidates:= Processor_analyze(proc,p,3*W, W, H,StrToInt(max_height)); ----<<<< call from dll

       raise Exception.Create('Test Exception'); ----<<<< if here, no problem
    
   except
      //
   end;

   raise Exception.Create('Test Exception'); ----<<<< if here - program terminates

except
  //
end;

 

Can somebody help to solve? What to check? where to dig? Thanks.

 

I have Delphi 10.2

Share this post


Link to post
try
              
   Try ----<<< deleted
     
     candidates:= Processor_analyze(proc,p,3*W, W, H,StrToInt(max_height)); ----<<<< call from dll
    
   except ----<<< deleted
      //
   end; ----<<< deleted

   raise Exception.Create('Test Exception'); ----<<<< if here - program terminates

except
  //
end;

 

Miracle - I commented try except block and it start working like usual :))))

 

Maybe any comments?

Share this post


Link to post

Random crashes like this usually tend to imply that there is possible memory corruption at play.  What does Processor_analyze() actually do internally (if you have its source code), and are you sure you have declared it correctly (if importing it from a DLL)?

Edited by Remy Lebeau

Share this post


Link to post

I have just adjusted the title of this topic. Just „very strange issue“ could also apply to nearly everything. 😉

  • Like 1

Share this post


Link to post
On 9/4/2019 at 10:53 PM, Remy Lebeau said:

Random crashes like this usually tend to imply that there is possible memory corruption at play.  What does Processor_analyze() actually do internally (if you have its source code), and are you sure you have declared it correctly (if importing it from a DLL)?

This.

I remember having a similar issue a couple of years ago calling .DLL exported functions when I switched from D7 to D10.2. The issue was memory allocation for a string (* SizeOf(Char) was not included) which lead to a nice and beautiful memory corruption. The application always crashed several functions later so it was a pain in the butt to find it.

Anyways, memory corruption would indeed be my guess in this case, too.

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

×