# QtWebKit fails to run in Win x86 (Release Mode)

• I've built qt_4.8.2 with webkit using visual studio 2012. (Used fix from "Here":http://qt-project.org/forums/viewthread/17771)

Now my application works fine in debug build however in release it crashes when the mainFrame()->setHtml() was called with an access violation error.

The weird part is this problem does not happen in my x64 machine which has been built in the same way as the x86 machine apart from the x86 or x64 type.

I tried running the "webkit examples". Same story. In the x86 machines, release mode crashes with an access violation error while debug mode seems to work fine.

Could someone suggest anything I might be doing wrong here or missed please.

• Do you happen to mix debug and release version of your DLLs by accident?

• Hey Volker,

Nah. The dll's are in the exe's folder and release version dll's are just one's without the "d" .

"Video":http://videobam.com/ThRDu

^^

1. In that video initially am trying to run the application with my built release libraries using visual studio 2012. Which does not run and if executed from visual studio gives an exception and crashes.

2. the "qt_installer" folder from which i run the exe has dll's from the qt 4.8.2 installer for MSVC 2010. that seems to work fine.

3. Finally I run the debug version with my built debug dll's and they seem to be fine too.

Pretty confused by this. Not sure if MSVC 2012 has some incompatibility and hence builds webkit but with some problems in the back, and if thats the case why it works fine in debug but not in release.

My Literal build process was as follows.

1. Get the source tar ball for 4.8.2
2. From MSVC command prompt switch to qt folder (with env variables set)
3. Apply fix from the thread linked in my first post to hashset.h
4. in qmake.conf for win32-msvc2010 set QMAKE_COMPILER_DEFINES += _MSC_VER=1700 WIN32
5. configure -debug-and-release -opensource -confirm-license -shared -platform win32-msvc2010 -qt-zlib -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg
6. nmake

Process finished with no errors.

• Just to update,

using the qt installer dll's is not an option as for qt example's it runs fine. However when the c runtime library is used because of your own code, it fails again (VS 2012RC)

Seems like some memory being allocated is not working out well with Visual studio 2012 on x86 release mode.

Am stuck trying to find exactly where the problem might be to try and fix it in webkit if so.

• Was finally able to build QtWebKit4.dll from Visual studio with the debugging symbols.

Found the function causing the problem.

"Bug Report":https://bugs.webkit.org/show_bug.cgi?id=90008

• WorkAround:

in file "TextEncodingRegistry.cpp" path: "\src\3rdparty\webkit\Source\WebCore\platform\text"

Replace

@
{
const char* atomicName = textEncodingNameMap->get(name);
ASSERT(atomicName);
}
@

With

@
{
// const char* atomicName = textEncodingNameMap->get(name);
const char* atomicName;
TextEncodingNameMap::iterator pos;
for (pos = textEncodingNameMap->begin(); pos != textEncodingNameMap->end(); ++pos) {
if (strcmp(pos->first, name) == 0) {
atomicName = pos->second;
break;
}
}
ASSERT(atomicName);
}
@

and Replace

@
PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding)
{
MutexLocker lock(encodingRegistryMutex());

ASSERT(textCodecMap);
TextCodecFactory factory = textCodecMap->get(encoding.name());
ASSERT(factory.function);


}
@

With

@
PassOwnPtr<TextCodec> newTextCodec(const TextEncoding& encoding)
{
MutexLocker lock(encodingRegistryMutex());

ASSERT(textCodecMap);
// TextCodecFactory factory = textCodecMap->get(encoding.name());


TextCodecFactory factory;
TextCodecMap::iterator pos;
for (pos = textCodecMap->begin(); pos != textCodecMap->end(); ++pos) {
if (strcmp(pos->first, encoding.name()) == 0) {
factory = pos->second;
break;
}
}
ASSERT(factory.function);