Fix tst_qsql crashes on Mac OS X
In tst_qsql, there are function calls to QApplication(argc, 0, false), where argc is zero. According to the documentation, argc must be greater than zero and argv must contain at least one valid character string. The misuse of this API has no problem on any platform other than Mac OS. This commit has fixed the crash by passing valid dummy parameters. Task-number: QTBUG-22811 Change-Id: I42b26d66f0becb7a942896e6ddcaea52ff720a48 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
parent
ad8edac53c
commit
4d696d53b0
@ -8,5 +8,3 @@ SUBDIRS=\
|
||||
qsqlrecord \
|
||||
qsqlthread \
|
||||
qsql \
|
||||
|
||||
mac: qsql.CONFIG = no_check_target # QTBUG-22811
|
||||
|
@ -116,8 +116,9 @@ void tst_QSql::cleanup()
|
||||
// of a field "id"(integer) and "name"(char/varchar).
|
||||
void tst_QSql::basicDriverTest()
|
||||
{
|
||||
int argc = 0;
|
||||
QGuiApplication app( argc, 0, false );
|
||||
int argc = 1;
|
||||
const char *argv[] = {"test"};
|
||||
QGuiApplication app(argc, const_cast<char **>(argv), false);
|
||||
tst_Databases dbs;
|
||||
dbs.open();
|
||||
|
||||
@ -157,11 +158,11 @@ void tst_QSql::basicDriverTest()
|
||||
void tst_QSql::open()
|
||||
{
|
||||
int i;
|
||||
int argc = 0;
|
||||
int argc = 1;
|
||||
const char *argv[] = {"test"};
|
||||
int count = -1;
|
||||
for ( i = 0; i < 10; ++i ) {
|
||||
|
||||
QApplication app( argc, 0, false );
|
||||
QApplication app(argc, const_cast<char **>(argv), false);
|
||||
tst_Databases dbs;
|
||||
|
||||
dbs.open();
|
||||
@ -186,8 +187,9 @@ void tst_QSql::openInvalid()
|
||||
|
||||
void tst_QSql::concurrentAccess()
|
||||
{
|
||||
int argc = 0;
|
||||
QGuiApplication app( argc, 0, false );
|
||||
int argc = 1;
|
||||
const char *argv[] = {"test"};
|
||||
QGuiApplication app(argc, const_cast<char **>(argv), false);
|
||||
tst_Databases dbs;
|
||||
|
||||
dbs.open();
|
||||
@ -214,8 +216,9 @@ void tst_QSql::concurrentAccess()
|
||||
|
||||
void tst_QSql::openErrorRecovery()
|
||||
{
|
||||
int argc = 0;
|
||||
QGuiApplication app( argc, 0, false );
|
||||
int argc = 1;
|
||||
const char *argv[] = {"test"};
|
||||
QGuiApplication app(argc, const_cast<char **>(argv), false);
|
||||
tst_Databases dbs;
|
||||
|
||||
dbs.addDbs();
|
||||
@ -261,8 +264,9 @@ void tst_QSql::openErrorRecovery()
|
||||
|
||||
void tst_QSql::registerSqlDriver()
|
||||
{
|
||||
int argc = 0;
|
||||
QGuiApplication app( argc, 0, false );
|
||||
int argc = 1;
|
||||
const char *argv[] = {"test"};
|
||||
QGuiApplication app(argc, const_cast<char **>(argv), false);
|
||||
|
||||
QSqlDatabase::registerSqlDriver( "QSQLTESTDRIVER", new QSqlDriverCreator<QSqlNullDriver> );
|
||||
QVERIFY( QSqlDatabase::drivers().contains( "QSQLTESTDRIVER" ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user