diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp index 2f51debdd0..5e69778a2a 100644 --- a/src/sql/kernel/qsqlerror.cpp +++ b/src/sql/kernel/qsqlerror.cpp @@ -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; } diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index bdfcc2d350..188e3fdc25 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -27,6 +27,8 @@ ** ****************************************************************************/ +#define _CRT_SECURE_NO_WARNINGS 1 + #include #include #include diff --git a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp index 5f99cec3af..60b0c697c5 100644 --- a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp +++ b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp @@ -26,6 +26,8 @@ ** ****************************************************************************/ +#define _CRT_SECURE_NO_WARNINGS 1 + #include #include #include