Fix collate warning after addition of multi-threaded loading

The no collate function warning is triggered in a thread which is used
for loading data. However, the warning is a message box and GUI elements
can only be drawn in the main thread. So the old code would crash. This
is fixed here by jumping to the main thread for showing the message box.
This commit is contained in:
Martin Kleusberg
2017-10-16 21:58:30 +02:00
parent 681456733e
commit 32da4de94d
4 changed files with 39 additions and 12 deletions
+5
View File
@@ -19,6 +19,8 @@ enum
typedef QMultiMap<QString, sqlb::ObjectPtr> objectMap; // Maps from object type (table, index, view, trigger) to a pointer to the object representation
typedef QMap<QString, objectMap> schemaMap; // Maps from the schema name (main, temp, attached schemas) to the object map for that schema
int collCompare(void* pArg, int eTextRepA, const void* sA, int eTextRepB, const void* sB);
class DBBrowserDB : public QObject
{
Q_OBJECT
@@ -117,6 +119,7 @@ signals:
void sqlExecuted(QString sql, int msgtype);
void dbChanged(bool dirty);
void structureUpdated();
void requestCollation(QString name, int eTextRep);
private:
QString curDBFilename;
@@ -125,6 +128,8 @@ private:
bool isEncrypted;
bool isReadOnly;
void collationNeeded(void* pData, sqlite3* db, int eTextRep, const char* sCollationName);
bool tryEncryptionSettings(const QString& filename, bool* encrypted, CipherDialog*& cipherSettings);
bool dontCheckForStructureUpdates;