PDA

View Full Version : Qt 4.8.3 and ptlib 2.10.8 refuse to work together



BigFastAndrey
5th December 2012, 09:54
Hello all.

I use both these libraries in my project. Below I describe a conflict between them.

See ole initialization code used in Qt:
file C:\Qt\4.8.3\src\gui\kernel\qapplication_win.cpp

#ifndef Q_WS_WINCE
// Initialize OLE/COM
// S_OK means success and S_FALSE means that it has already
// been initialized
HRESULT r;
r = OleInitialize(0);
if (r != S_OK && r != S_FALSE) {
qWarning("Qt: Could not initialize OLE (error %x)", (unsigned int)r);
}
#endif
WinAPI function OleInitialize returns error code defined as RPC_E_CHANGED_MODE (Cannot change thread mode after it is set), because OLE has already been initialized by ptlib by
::CoInitializeEx(NULL, COINIT_MULTITHREADED);
invocation.
qWarning shows this message: "Qt: Could not initialize OLE (error 80010106)".

But after application is closed, it crashes with access violation and following call stack:
http://i50.tinypic.com/2saxxg9.png

Here we see ole32.dll...
Apparently, root cause is differed OLE initialization parameters and maybe combined OLE usage.

Can anyone help me to reveal a workaround?
Thank you.