Merge "QSqlError: protect against self-assignment"

bb10
Volker Hilsheimer 2021-03-17 15:11:22 +01:00 committed by Qt CI Bot
commit 48ce0bed62
3 changed files with 10 additions and 2 deletions

View File

@ -151,9 +151,13 @@ QSqlError::QSqlError(const QSqlError& other)
QSqlError& QSqlError::operator=(const QSqlError& other)
{
if (d)
if (&other == this)
return *this;
if (d && other.d)
*d = *other.d;
else
else if (d)
*d = QSqlErrorPrivate();
else if (other.d)
d = new QSqlErrorPrivate(*other.d);
return *this;
}

View File

@ -27,6 +27,8 @@
**
****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS 1
#include <QTest>
#include <QScopedValueRollback>
#include <qplatformdefs.h>

View File

@ -26,6 +26,8 @@
**
****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS 1
#include <QtCore/QString>
#include <QTest>
#include <QtCore/private/qipaddress_p.h>