Qt application crash when compiled for 64-bit VS2010

Callstack

>	QtGui4.dll!00000000652f071f()
 	[Frames below may be incorrect and/or missing, no symbols loaded for QtGui4.dll]
 	QtGui4.dll!00000000652f07ae()
 	QtGui4.dll!0000000065326821()
 	QtGui4.dll!0000000065327f30()
 	QtGui4.dll!00000000653284ba()
 	QtGui4.dll!000000006532a5f5()
 	QtGui4.dll!00000000652f4792()
 	QtGui4.dll!000000006532f701()
 	QtGui4.dll!000000006535be71()
 	QtCore4.dll!0000000059a0ab9f()
 	QtGui4.dll!0000000065306eb9()
 	QtCore4.dll!00000000599f7903()
 	QtGui4.dll!0000000064eaffa2()
 	QtGui4.dll!0000000064eb2e56()
 	QtCore4.dll!00000000599f7792()
 	QtGui4.dll!0000000064eec2a3()
 	QtGui4.dll!0000000064eee85e()
 	QtGui4.dll!0000000064eec265()
 	QtGui4.dll!0000000064eee85e()
 	QtGui4.dll!0000000064eec265()
 	QtGui4.dll!0000000064eee85e()
 	QtGui4.dll!0000000064efa870()
 	QtGui4.dll!0000000065208727()
 	QtGui4.dll!000000006527a082()
 	QtGui4.dll!0000000064eaffb6()
 	QtGui4.dll!0000000064eb2e56()
 	QtCore4.dll!00000000599f7792()
 	QtGui4.dll!0000000064ef264c()
 	QtGui4.dll!0000000064ef26c7()
 	QtGui4.dll!0000000064ef26c7()
 	QtGui4.dll!0000000064ef26c7()
 	QtGui4.dll!0000000064efe30c()
 	OrmDesigner2.exe!000000013f95a2cf()
 	OrmDesigner2.exe!000000013f95dce2()
 	kernel32.dll!000000007794652d()
 	ntdll.dll!0000000077c8c521()

The bug is probably caused by wrong alignment or incorrect VS2010 compiler optimalization.

Found resources:
https://bugreports.qt.nokia.com//browse/QTBUG-11445
https://connect.microsoft.com/VisualStudio/feedback/details/573262/incorrect-alignment-with-x64-optimizer-and-movaps
http://support.microsoft.com/kb/2280741
https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=31433

Workarounds:

First way – Update VS2010 mkspec for Qt

go to $QTDIR/mkspecs/win32-msvc2010/qmake.conf and replace -02 with -01 (ie. reducing the optimzation level).Also /Ob0 could be used.

Microsoft hotfix for VS

http://archive.msdn.microsoft.com/KB2280741
File patch name VS10-KB2268081-x86.exe

Install Visual Studio 2010 SP1

Service pack could also contains required fix.
http://www.microsoft.com/download/en/details.aspx?id=23691

Timeout errors reported by iastor or iastor(v) in Microsoft Event Viewer

Problem:

The device, \Device\Ide\iaStor0, did not respond within the timeout period.

Solution:

Install newest Intel Rapid Storage Technology for Windows Vista/7. This could helped resolve this issue.

http://www.intel.com/support/chipsets/imsm/sb/cs-025783.htm

Solution2:

http://solutions.unixsherpa.com/2010/03/25/the-device-deviceideiastor0-did-not-respond-within-the-timeout-period/

Solution3:

asus drivery zde: http://support.asus.com.tw/download/download.aspx?SLanguage=cs-cz

firmware na ssd zde http://www.ocztechnology.com/ssd_tools/OCZ_Vertex_3,_Vertex_3_Max_IOPS,_Agility_3,_Solid_3,_RevoDrive_3_and_RevoDrive_3_X2/

disk je potreba updatovat z jineho hdd nebo live cd, nelze updatovat pokud je z nej nabootovano.

a tady je navod jak povolit HotPlug v biosu a zakazat LPM ve windows:

http://www.ocztechnologyforum.com/forum/showthread.php?88340-Vertex-3-Windows-install-in-AHCI-mode-on-Intel-6-series-Chipset-platforms

How to enable Send As in Exchange 2010

When you have more than one email for each user in your exchange 2010, it’s necessary to configure Exchange to support it.

How is steps necessary to do that:

1) Create shared Mailbox.

The simpliest way is use Exchange management shell(EMS) and execute following command:

New-Mailbox -Name:'[email protected]' -UserPrincipalName:'[email protected]' -Shared

2) Assign permissions

As next thing you have to assign permissions for users which will use this mailbox for sending emails.

Add-ADPermission "[email protected]" -User "UserWhoWillUseThisAccount" -Extendedrights "Send As"

3) Use it

Check “From” button in “Options” tab and enter shared address to “From” field in the mail header.

Note:

When mails will be forwarded back with error about “not enought permissions”, simply remove exchange account from outlook and add it back again. This solution resolve my problem after 6 hours of debugging ;-(

Usefull web links:

OpenCart customizations and tuning

SEO

replace all ugly ?route=common/home to home page address – Self made 😉

In file /catalog/controller/common/seo_url.php add following line to almost the end of function rewrite($link) (line 122):


} else {

//convert http://sparring-time.com/index.php?route=common/home to http://sparring-time.com
$link = str_replace('/index.php?route=common/home','',$link);
return $link;
}

And that’s it ;-). Instead of replacing lot of controller php files or any other modification, simply add this one line 😉

other…

Open cart auto seo – Automatically generates SEO for all product ( rewrite all old values ;-( )

Modifications

Add extra links where home… login…

Themes

http://demo6.imaginetech.com.au/index.php?route=common/home
http://demo.opencart-help.com/07/

Strange “no matching function for call to …” error on MacOS

Error appear when using BOOST::fusion::map<....>

Error message:

In file included from axOrm/ormObject/ormObject.test.cpp:5:
axOrm/ormObject/testObjects/objContactAndAddress.h: In member function 'void Atomix::Orm::Tests::CBaseOrmContact::SetName(XString)':
axOrm/ormObject/testObjects/objContactAndAddress.h:92: error: no matching function for call to 'Atomix::Orm::Tests::CBaseOrmContact::GetPropertyHolder()'

Invalid source code

template <class TNameParam> typename fus::result_of::at_key< TmapAssociations,TNameParam>::type & GetAssociationHolder()
{ return fus::at_key<TNameParam>(m_mapAssociations); }

for fix simply change result_of::at_key to result_of::value_at_key

template <class TNameParam> typename fus::result_of::value_at_key<TmapAssociations,TNameParam>::type & GetAssociationHolder()

After fixing this error, you can achieved problem with const modifier. Correct syntax for const definition is:

template typename fus::result_of::value_at_key::type const & GetPropertyHolder() const
{ return fus::at_key(m_mapProperties); }

C++ – unpack sub-type from template structure only for specified object type

#include <assert.h>
#include <typeinfo>
 
struct CTreeObject1
{
};
 
/************************************************************************/
/* Nammed structs - for using one type more than once in SinglesCont.   */
/************************************************************************/
template< class TObject, class TName>
struct NammedObject : public TObject, public TName 
{
        typedef TObject object_type;
};
 
struct stFirst{};
struct stSecond{};
                
template <typename T>
struct UnpackObjectType
{
        typedef T TT;
};
 
template<typename T, typename U>
struct UnpackObjectType< NammedObject<T, U> >
{
        typedef T TT; 
};
 
int main()
{
        typedef NammedObject<CTreeObject1,stFirst>  T1;
        typedef NammedObject<CTreeObject1,stSecond>  T2;
        typedef CTreeObject1                        T3;
 
        UnpackObjectType<T1>::TT d1;
        UnpackObjectType<T2>::TT d2;
        UnpackObjectType<T3>::TT d3;
        
        //required
        assert( typeid(d1) == typeid(d2));
        assert( typeid(d2) == typeid(d3));
        
        return 0;
}

g++ error: conversion from XTestObjectA to non-scalar type XTestObjectBase requested

//error
XTestObjectBase objTestObjectBase1 = objTestObjectA;

//ok
XTestObjectBase objTestObjectBase2(objTestObjectA);

//ok
XTestObjectBase objTestObjectBase3; objTestObjectBase3 = objTestObjectA;

cite from: http://stackoverflow.com/questions/6120240/why-constructor-is-not-called-for-given-casting-operator

The problem is that the number of user-defined conversions that are invoked implicitly is limited (to 1) by the Standard.

B ob = a;
implies two user conversions:

on a: Wrap::operator A*() should be called
on the result: B::B(A*) should be called

The solution is to use explicit conversion

//now ok
XTestObjectBase objTestObjectBase1 = XTestObjectBase(objTestObjectA);

g++ error: expected primary-expression before > token

For g++ compiler is sometimes necessary to specify more typename / template keywords than for Visual Studio. This is one of examples.

To the following code it’s necessary to add template keyword:

TMemoryManager & memMngr = GetMemoryManager();
m_pObject = 
  memMngr.CreateObject<TObject>(this, m_pContainerOwner);

use

TMemoryManager & memMngr = GetMemoryManager();
m_pObject = 
  memMngr.template CreateObject<TObject>(this, m_pContainerOwner);

MinGW and compilation 32/64bit libraries

Install MinGW-64

1) Download MinGW 64-bit and 32-bit

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/

– Toolchains targetting Win64 / Toolchains targetting Win32
– Automated Builds
– mingw-w64-1.0-bin_i686-mingw_*.zip
– mingw-w32-1.0-bin_i686-mingw_*.zip

2) Download MSYS compatible with 64-bit MinGW

http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20(Win64%20hosted)/MSYS%20(32-bit)/

3) Extract MinGW32, mingw64 and MSYS to one folder

MinGW-32, MinGW-64 and MSYS to folder MinGW64 (Bin folder from MinGW will be merged with bin folder from MSYS, etc.)

External links:

MSYS wiki
MinGW-64 wiki