Try parsing a message in main(), both in the main thread and in a QtConcurrent thread.
(cherry picked from commit 141bdc6888
)
This commit is contained in:
parent
f5962dd945
commit
913eca664d
20
src/main.cpp
20
src/main.cpp
|
@ -49,6 +49,8 @@
|
|||
#include "version.h"
|
||||
#include "widgets/osd.h"
|
||||
|
||||
#include "tagreadermessages.pb.h"
|
||||
|
||||
#include "qtsingleapplication.h"
|
||||
#include "qtsinglecoreapplication.h"
|
||||
|
||||
|
@ -60,6 +62,7 @@
|
|||
#include <QSqlQuery>
|
||||
#include <QTextCodec>
|
||||
#include <QTranslator>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QtDebug>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
@ -214,6 +217,17 @@ void ScanGIOModulePath() {
|
|||
}
|
||||
#endif
|
||||
|
||||
void ParseAProto() {
|
||||
const QByteArray data = QByteArray::fromHex(
|
||||
"08001a8b010a8801b2014566696c653a2f2f2f453a2f4d7573696b2f28414c42554d2"
|
||||
"9253230476f74616e25323050726f6a6563742532302d253230416d6269656e742532"
|
||||
"304c6f756e67652e6d786dba012a28414c42554d2920476f74616e2050726f6a65637"
|
||||
"4202d20416d6269656e74204c6f756e67652e6d786dc001c7a7efd104c801bad685e4"
|
||||
"04d001eeca32");
|
||||
pb::tagreader::Message message;
|
||||
message.ParseFromArray(data.constData(), data.size());
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (CrashReporting::SendCrashReport(argc, argv)) {
|
||||
return 0;
|
||||
|
@ -393,6 +407,12 @@ int main(int argc, char *argv[]) {
|
|||
// Icons
|
||||
IconLoader::Init();
|
||||
|
||||
// This is a nasty hack to ensure that everything in libprotobuf is
|
||||
// initialised in the main thread. It fixes issue 3265 but nobody knows why.
|
||||
// Don't remove this unless you can reproduce the error that it fixes.
|
||||
ParseAProto();
|
||||
QtConcurrent::run(&ParseAProto);
|
||||
|
||||
Application app;
|
||||
|
||||
Echonest::Config::instance()->setAPIKey("DFLFLJBUF4EGTXHIG");
|
||||
|
|
Loading…
Reference in New Issue