ShowDialog causes heap error
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.
精彩评论