Dear Thiago Macieira.
In your last message you requested more debug information. So, I rebuilt
Qt with debug options and I generated a more detailed debug. Further, I
analyzed the debug information and I added more application debug.
I suspect the static function “QTextCode::codecForLocale()” is not well
behaviored with ICU 52.1. If you compare the app debug with and without
ICU 52.1 support you will notice:
1) With ICU 52.1: “QTextCode::codecForLocale()” is returning 0x0
2) Without ICU 52.1: “QTextCode::codecForLocale()” is return a valid pointer
Also, you can see the same behavior when comparing
QTextCodec::codecForName(mysql_character_set_name(mysql))
1) With ICU 52.1: it returns 0x0
2) Without ICU 52.1: it returns 0x3e4f48
Notes:
1) I am watching “QTextCode::codecForLocale()” and
“QTextCodec::codecForName(mysql_character_set_name(mysql))” because I
believe only these functions can change the variable: “QTextCodec
*MYSQLDriverPrivate::tc” [see stack #1 and #0]
2) You can find “QTextCodec *MYSQLDriverPrivate::tc” in:
qtbase\src\sql\drivers\mysql\qsql_mysql.cpp
Best regards,
Thales Lange.
On 16-12-2013 17:50, Thiago Macieira wrote:
On segunda-feira, 16 de dezembro de 2013 16:25:46, Thales Lange wrote:
Dear Thiago Macieira,
I attached to this e-mail the backtrace (GDB 7.6). Main Result:
Program received signal SIGSEGV, Segmentation fault.
0x68a11c03 in ZNK10QTextCodec11fromUnicodeERK7QString ()
from C:\test\Qt5Core.dll
I didn't compile Qt itself with debug support. If you need more
information, ask me please. I am not used to gdb command line.
To narrow it further down, I'll need debugging info.
The function you listed above calls the virtual convertFromUnicode, which
didn't show up in your stack trace and would indicate which codec it was
trying to use and why it crashed.
It's still possible that ICU is at fault here, but I can't prove it or
disprove it right now.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
******************************WITH ICU 52.1******************************
##################function static QTextCode *codec(MYSQL *mysql)###############
mysql_character_set_name(mysql) : utf8
QTextCodec::codecForName(mysql_character_set_name(mysql)) : 0x0
###############################################################################
===============================================================================
#########################int main(int argc, char **argv)#######################
QTextCode::codecForLocale() : 0x0
Is Database open ? true
QSqlDatabase last Error : ""
******************************WITHOUT ICU 52.1*********************************
##################function static QTextCode *codec(MYSQL *mysql)###############
mysql_character_set_name(mysql) : utf8
QTextCodec::codecForName(mysql_character_set_name(mysql)) : 0x3e4f48
###############################################################################
===============================================================================
#########################int main(int argc, char **argv)#######################
QTextCode::codecForLocale() : 0x3e4eb8
Is Database open ? true
QSqlDatabase last Error : ""
is exec ok? : true
is next ok? : true
Value : "1"
###############################################################################
Starting program: C:\test\test.exe
[New Thread 3216.0xd70]
Program received signal SIGSEGV, Segmentation fault.
0x006593aa in QTextCodec::fromUnicode (this=0x0, str=...)
at codecs\qtextcodec.cpp:807
807 return convertFromUnicode(str.constData(), str.length(), 0);
#0 0x006593aa in QTextCodec::fromUnicode (this=0x0, str=...)
at codecs\qtextcodec.cpp:807
No locals.
#1 0x6ad818d6 in fromUnicode (tc=0x0, str=...)
at ..\..\..\sql\drivers\mysql\qsql_mysql.cpp:122
No locals.
#2 0x6ad8363e in QMYSQLResult::reset (this=0x3e6b80, query=...)
at ..\..\..\sql\drivers\mysql\qsql_mysql.cpp:704
encQuery = {d = 0x22fcd8}
numFields = 2293000
#3 0x67941f40 in QSqlQuery::exec (this=0x22fd90, query=...)
at kernel\qsqlquery.cpp:378
__PRETTY_FUNCTION__ = "bool QSqlQuery::exec(const QString&)"
#4 0x00401bb7 in main (argc=1, argv=0x3e2938) at main.cpp:30
app = {<QObject> = {
_vptr.QObject = 0x890fe8 <vtable for QCoreApplication+8>,
static staticMetaObject = {d = {superdata = 0x0,
stringdata = 0x826420 <qt_meta_stringdata_QObject>,
data = 0x826500 <qt_meta_data_QObject>,
static_metacall = 0x637084
<QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>,
relatedMetaObjects = 0x0,
extradata = 0x0}}, d_ptr = {d = 0x3e4298},
static staticQtMetaObject = {d = {superdata = 0x0,
stringdata = 0x8745a0 <qt_meta_stringdata_Qt>,
data = 0x87bf60 <qt_meta_data_Qt>, static_metacall = 0x0,
relatedMetaObjects = 0x0, extradata = 0x0}}},
static staticMetaObject = {d = {
superdata = 0x8260c0 <QObject::staticMetaObject>,
stringdata = 0x887480 <qt_meta_stringdata_QCoreApplication>,
data = 0x887640 <qt_meta_data_QCoreApplication>,
static_metacall = 0x688dfc
<QCoreApplication::qt_static_metacall(QObject*, QMetaObject::Call, int,
void**)>, relatedMetaObjects = 0x0,
extradata = 0x0}}, static self = 0x22fd98}
db = {static defaultConnection =
0x67a06625 <_ZStL6ignore+419> "qt_sql_default_connection", d = 0x3e4618}
query = {d = 0x3e6ce0}
__PRETTY_FUNCTION__ = "int main(int, char**)"
A debugging session is active.
Inferior 1 [process 3216] will be killed.
Quit anyway? (y or n)
#include <QDebug>
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
#include <QTextCodec>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("192.168.15.101");
db.setUserName("Andre");
db.setPassword("andre");
db.setDatabaseName("PRODUCAO_DATA");
db.setPort(3306);
db.open();
QSqlQuery query(db);
qDebug() << "";
qDebug() << "#########################int main(int argc, char **argv)#######################";
qDebug() << "QTextCode::codecForLocale() :" << QTextCodec::codecForLocale();
qDebug() << "Is Database open ?" << db.isOpen();
qDebug() << "QSqlDatabase last Error :" << db.lastError().driverText();
qDebug() << "###############################################################################";
qDebug() << "";
qDebug() << "is exec ok? : " << query.exec("SELECT 1");
qDebug() << "is next ok? : " << query.next();
qDebug() << "Value : " << query.value(0).toString();
return 0;
}
#-------------------------------------------------
#
# Project created by QtCreator 2013-12-11T20:59:14
#
#-------------------------------------------------
QT += core sql
QT -= gui widgets
win32:DESTDIR = C:\test
CONFIG -= debug \
debug_and_release \
x11
CONFIG *= \
debug \
console
TARGET = test
TEMPLATE = app
SOURCES += main.cpp
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest