Bug 38759 - [Qt] Initializing the icon database twice in a row raise an assert
Summary: [Qt] Initializing the icon database twice in a row raise an assert
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Critical
Assignee: Nobody
URL:
Keywords: Qt, QtTriaged
Depends on:
Blocks:
 
Reported: 2010-05-07 09:38 PDT by Jocelyn Turcotte
Modified: 2011-04-19 05:15 PDT (History)
2 users (show)

See Also:


Attachments
Test app (518 bytes, application/octet-stream)
2010-05-07 09:38 PDT, Jocelyn Turcotte
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jocelyn Turcotte 2010-05-07 09:38:01 PDT
Created attachment 55387 [details]
Test app

See the attached test for a common possible case:

    QWebSettings::enablePersistentStorage();
    QWebSettings::globalSettings()->setIconDatabasePath(".");


When we call QWebSettings::setIconDatabasePath() we don't make sure that the icon database has been closed before opening it again.

There is protection for that in IconDatabase::open() by checking if the sqlite database is open, however it don't work here since the state only change when the database is opened on the spawned thread.

I don't know what happens in release, there might be an opened sqlite database on the first path specified to setIconDatabasePath.

Reproduced on MSVC2008.
Comment 1 Benjamin Poulain 2010-11-10 06:54:55 PST
Works for me.

Your example crashes because there is no QApplication instance so threads are not working properly. By changing it to:

#include <QApplication>
#include <QWebSettings>

int main(int argc, char** argv)
{
    QApplication app(argc, argv);
    QWebSettings::enablePersistentStorage();
    QWebSettings::globalSettings()->setIconDatabasePath(".");
    return 0;
}

Everything works for me.