Remove Q_ASSERT's from QVariant autotest.

Print a meaningful warning message instead of aborting in debug
mode builds and failing silently in release mode builds.

Change-Id: I44143c5fbe6b6af87bdf5bd231cfaf9a3c9c33f8
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit a8dc321b6669dd263a25a0cb5766e5b7150c6e20)
This commit is contained in:
Jason McDonald 2011-05-03 15:58:24 +10:00 committed by Rohan McGovern
parent fd714ec5aa
commit dffae678dd

View File

@ -3239,18 +3239,21 @@ struct MyData
{
void *ptr;
MyData() : ptr(this) {}
~MyData() { Q_ASSERT(ptr == this); }
~MyData()
{
if (ptr != this) qWarning("MyData::~MyData(): object has moved");
}
MyData(const MyData& o) : ptr(this) { Q_ASSERT(o.ptr == &o); }
MyData &operator=(const MyData &o)
{
Q_ASSERT(ptr == this);
Q_ASSERT(o.ptr == &o);
if (ptr != this) qWarning("MyData::operator=(): object has moved");
if (o.ptr != &o) qWarning("MyData::operator=(): other object has moved");
return *this;
}
bool operator==(const MyData &o) const
{
Q_ASSERT(ptr == this);
Q_ASSERT(o.ptr == &o);
if (ptr != this) qWarning("MyData::operator==(): object has moved");
if (o.ptr != &o) qWarning("MyData::operator==(): other object has moved");
return true;
}
};