开发者

ShowDialog causes heap error

开发者 https://www.devze.com 2023-04-12 22:54 出处:网络
I have a COM server (out-of-process) in which I call ShowDialog() of an FolderBrowserDialog (C++, WindowsForms). When I then want to stop the COM server, it crashes, saying there is a heap error. If I

I have a COM server (out-of-process) in which I call ShowDialog() of an FolderBrowserDialog (C++, WindowsForms). When I then want to stop the COM server, it crashes, saying there is a heap error. If I just create the FolderBRowserDialog without calling ShowDialog, the error doesn't occure... When doing research I read something about having to dispose manually, but the dispose method ca开发者_运维知识库nnot be called. Using delete does also not fix my problem. Any ideas? Here is the code snippet:

...
FolderBrowserDialog^ fbd = gcnew FolderBrowserDialog(); 
fbd->Description = "MAS Open dialog";
fbd->RootFolder = Environment::SpecialFolder::MyComputer;
fbd->SelectedPath = Str;
...
res = fbd->ShowDialog(gcnew WindowWrapper(hwnd));
...


I just had the same problem, you have to call

delete fbd;

after ShowDialog.

0

精彩评论

暂无评论...
验证码 换一张
取 消