Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, July 2007
Runtime Library: MD or MDd ?


Message 1 in thread

Hi All,

I am using Qt in VS2003 on WindowsXP. The compiler Runtime Library can be:
1) Multi-threaded DLL (/MD)
2) Multi-threaded Debug DLL (/MDd)

I have a table widget which is a subclass of QTableWidget,
where for selection I have:
QList<QTableWidgetSelectionRange> ranges = this->selectedRanges();

If I compile the program under /MD my program will crash when the QList 
in destruction.
Error message is a "Unhandled exception at 0x7c901230" (google it you 
can find two thousands)

If I compile the project under /MDd, the program works fine.

Can someone teach me why the /MD crashes, while /MDd does not?
A simple test zip is ready for you if you want to make above problem test.

Thanks,
Lingfa


--
 [ signature omitted ] 

Message 2 in thread

Lingfa Yang wrote:
> Hi All,
>
> I am using Qt in VS2003 on WindowsXP. The compiler Runtime Library can 
> be:
> 1) Multi-threaded DLL (/MD)
> 2) Multi-threaded Debug DLL (/MDd)
>
> I have a table widget which is a subclass of QTableWidget,
> where for selection I have:
> QList<QTableWidgetSelectionRange> ranges = this->selectedRanges();
>
> If I compile the program under /MD my program will crash when the 
> QList in destruction.
> Error message is a "Unhandled exception at 0x7c901230" (google it you 
> can find two thousands)
>
> If I compile the project under /MDd, the program works fine.
>
> Can someone teach me why the /MD crashes, while /MDd does not?
you are probably having some memory overrun problems, in debug mode the 
compiler
puts some padding around allocations so it can check for overruns, in 
release mode
it does not. So if you allocate e.g an array in debug mode and write one 
word past
the array end you will be OK, but in release mode you will corrupt 
something else.

- Keith

--
 [ signature omitted ] 

Message 3 in thread

Hi,

> If I compile the program under /MD my program will crash when the QList 
> in destruction.
> Error message is a "Unhandled exception at 0x7c901230" (google it you 
> can find two thousands)
> 
> If I compile the project under /MDd, the program works fine.

You may also be mixing C runtime libraries:
http://msdn2.microsoft.com/en-us/library/ms235460.aspx

--
 [ signature omitted ]