[KPhotoAlbum] fix crash with QT 5.10 on Archlinux

Johannes Zarl-Zierl johannes at zarl-zierl.at
Mon Jan 1 21:01:32 GMT 2018


Hello Sylvain,

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

Cheers, and a happy new year to you, too!
  Johannes


On Montag, 1. Jänner 2018 21:04:46 CET Sylvain Stanchina wrote:
> 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





More information about the Kphotoalbum mailing list