Discussion:
[KPhotoAlbum] fix crash with QT 5.10 on Archlinux
Sylvain Stanchina
2018-01-01 20:04:46 UTC
Permalink
hello,

On Archlinux (using QT5.10), KPA always crashes when it imports new
pictures. The patch in attachment solves the issue.

Some explanations: The issue is related to SQL queries containing
placeholders ("?"). In Exif.Database.cpp, some queries are built using
the statement "QSqlQuery query( _queryString, m_db );" (or equivalent).
However, according to QT5.10 documentation, the queries are immediately
executed when constructed like that. If they contain one or more
placeholders "?", they are thus executed before their arguments have
been bound (by calls of bindValue()). In such cases, the application
crashes.

That's why I replaced such constructs by two statements:
First: QSqlQuery query( m_db ); which doesn't execute the query
Second: query.prepare(_queryString);
The query is executed later by a call of exec();

I hope this patch has no side effect.

Happy New Year !!

Sylvain
Johannes Zarl-Zierl
2018-01-01 21:01:32 UTC
Permalink
Hello Sylvain,

Thanks for the patch! I've added it to git master…

Cheers, and a happy new year to you, too!
Johannes
Post by Sylvain Stanchina
hello,
On Archlinux (using QT5.10), KPA always crashes when it imports new
pictures. The patch in attachment solves the issue.
Some explanations: The issue is related to SQL queries containing
placeholders ("?"). In Exif.Database.cpp, some queries are built using
the statement "QSqlQuery query( _queryString, m_db );" (or equivalent).
However, according to QT5.10 documentation, the queries are immediately
executed when constructed like that. If they contain one or more
placeholders "?", they are thus executed before their arguments have
been bound (by calls of bindValue()). In such cases, the application
crashes.
First: QSqlQuery query( m_db ); which doesn't execute the query
Second: query.prepare(_queryString);
The query is executed later by a call of exec();
I hope this patch has no side effect.
Happy New Year !!
Sylvain
Loading...