Hi
I have a problem that I don't understand yet. Someone here might be able tell me what to look for.
The problem is related in to the open and save file dialog. I am learning the windows API for the file dialog by hacking on the Common File Dialog example written by Microsoft. My app runs fine but it crashes when I call exit or when I return from main.
The program does not crash if I display the task dialog from the example. What kind of problem am I facing? Could it be some kind of memory corruption in another part of the program or is it just a matter of calling release somewhere? Does something in the BasicFileDialog really depend on the task dialog?
The working looks like this:
Code:
void showTaskDialog () {
TASKDIALOGCONFIG taskDialogParams = { sizeof(taskDialogParams) };
taskDialogParams.dwFlags = TDF_USE_COMMAND_LINKS | TDF_ALLOW_DIALOG_CANCELLATION;
TASKDIALOG_BUTTON const buttons[] =
{
{ 0, L"OK" },
};
taskDialogParams.pButtons = buttons;
taskDialogParams.cButtons = ARRAYSIZE(buttons);
taskDialogParams.pszWindowTitle = L"OK";
int selectedId;
TaskDialogIndirect(&taskDialogParams, &selectedId, NULL, NULL);
}
void openFileDialog () {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED|COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
showTaskDialog ();
BasicFileOpen();
CoUninitialize();
}
}
The code that causes the crash on exit looks like this:
Code:
void openFileDialog () {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED|COINIT_DISABLE_OLE1DDE);
if (SUCCEEDED(hr))
{
BasicFileOpen();
CoUninitialize();
}
}
The stack trace looks like this:
Code:
Program received signal SIGSEGV, Segmentation fault.
0xfeeefeab in ?? ()
(gdb) bt
#0 0xfeeefeab in ?? ()
#1 0x74c23085 in FindGadgetFromPoint () from C:\Windows\system32\duser.dll
#2 0x74c22e7e in FindGadgetFromPoint () from C:\Windows\system32\duser.dll
#3 0x7735a604 in ntdll!RtlRemovePrivileges ()
from C:\Windows\system32\ntdll.dll
#4 0x7732a303 in ntdll!RtlRegisterWait () from C:\Windows\system32\ntdll.dll
#5 0x7732a38e in ntdll!RtlExtendMemoryBlockLookaside ()
from C:\Windows\system32\ntdll.dll
#6 0x75bed863 in KERNEL32!ExitThread () from C:\Windows\system32\kernel32.dll
#7 0x00000000 in ?? ()
The window crash reports claims that it is an access violation in ntshrui.dll
Cheers
Johan