Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Aug : GetOpenFileName causes a crash as program closes

www.cryer.info
Managed Newsgroup Archive

GetOpenFileName causes a crash as program closes

Subject:GetOpenFileName causes a crash as program closes
Posted by:"Witless" (an..@gmail.com)
Date:1 Aug 2005 10:53:07 -0700

I have spent hours trying to track down this problem.

I'm working on a program that has developed a mysterious crash on
closing. It seems to be the result of an interaction between unloading dll's and calling the Windows API function GetOpenFileName.

When I first launch the program I load a dll called Processor.dll which is also written in Delphi, shares some of the same units as the application, and uses the memory manager FastShareMem to allow simple string passing.

If I then immediateley unload the program and close the dll I get no error. However, if I first call GetOpenFileName I get an access violation as my program is closing down (after the FreeLibrary function has been called to unload the dll). If I never load the dll, or don't call GetOpenFileName the error does not occur. Also, setting break points near where the DLL is unloaded causes the error not to occur, making it even harder to track down.

I'm at my wit's end trying to figure out what is going on here. Perhaps it has something to do with the fact that GetOpenFileName leaves a few threads lying around after its called. However, I'm not sure how to close them directly, or how they could be interacting with the unloading of my dll.

Thanks in advance for any thoughts or suggestions.

Info

Glossary

File Types

Replies:

www.cryer.info
Managed Newsgroup Archive