diff -r 4cc2b2cd4184 -r 2dead6b84bca QTfrontend/HWApplication.cpp --- a/QTfrontend/HWApplication.cpp Tue Mar 12 02:30:36 2013 +0100 +++ b/QTfrontend/HWApplication.cpp Tue Mar 12 17:18:55 2013 +0100 @@ -45,6 +45,25 @@ for (int i = 1; i < argc; i++) qDebug("%d: %s", i, argv[i]); #endif + // on Windows, sending an event right away leads to a segfault + // so we use urlString to save the data and send the event just before the app.exec() + urlString = NULL; + if (argc > 1) { + urlString = new QString(argv[1]); + if (urlString->contains("//", Qt::CaseInsensitive) == false) { + delete urlString; + urlString = NULL; + } + } +} + +void HWApplication::fakeEvent() +{ + QUrl parsedUrl(*urlString); + delete urlString; + urlString = NULL; + QFileOpenEvent *openEvent = new QFileOpenEvent(parsedUrl); + QCoreApplication::sendEvent(QCoreApplication::instance(), openEvent); } bool HWApplication::event(QEvent *event) @@ -60,14 +79,14 @@ QFile file(path); if (scheme == "file" && file.exists()) { - form->PlayDemoQuick(openEvent->file()); + form->PlayDemoQuick(path); return true; } else if (scheme == "hwplay") { int port = openEvent->url().port(NETGAME_DEFAULT_PORT); form->NetConnectQuick(address, (quint16) port); return true; } else { - const QString errmsg = tr("Not yet implemented").arg(path); + const QString errmsg = tr("Scheme '%1' not supported").arg(scheme); MessageDialog::ShowErrorMessage(errmsg, form); return false; }