1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

IconProvider: Use SqlDatabase to exec query on correct database in imageForDomain

Fixes crash when being called from multiple threads with Qt 5.10

Closes #2491
This commit is contained in:
David Rosca 2017-10-23 16:03:15 +02:00
parent f011761a50
commit fe82dde871

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -225,7 +225,7 @@ QImage IconProvider::imageForDomain(const QUrl &url, bool allowNull)
query.prepare(QSL("SELECT icon FROM icons WHERE url GLOB ? LIMIT 1"));
query.addBindValue(QString("*%1*").arg(QzTools::escapeSqlGlobString(url.host())));
query.exec();
SqlDatabase::instance()->exec(query);
if (query.next()) {
return QImage::fromData(query.value(0).toByteArray());