forked from qt-creator/qt-creator
WebAssembly: fix crashes
Change-Id: I9a2a44c85a254628f119eb041036492bc3022cdf Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -42,7 +42,7 @@ namespace Internal {
|
||||
|
||||
static CommandLine emrunCommand(Target *target, const QString &browser, const QString &port)
|
||||
{
|
||||
BuildConfiguration *bc = target->activeBuildConfiguration();
|
||||
if (BuildConfiguration *bc = target->activeBuildConfiguration()) {
|
||||
const QFileInfo emrunScript = bc->environment().searchInPath("emrun").toFileInfo();
|
||||
auto html = bc->buildDirectory().pathAppended(target->project()->displayName() + ".html");
|
||||
|
||||
@@ -53,6 +53,8 @@ static CommandLine emrunCommand(Target *target, const QString &browser, const QS
|
||||
"--no_emrun_detect",
|
||||
html.toString()
|
||||
});
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
// Runs a webassembly application via emscripten's "emrun" tool
|
||||
|
@@ -41,7 +41,8 @@ static QStringList detectedBrowsers(ProjectExplorer::Target *target)
|
||||
{
|
||||
static QStringList result;
|
||||
if (result.isEmpty()) {
|
||||
const Utils::Environment environment = target->activeBuildConfiguration()->environment();
|
||||
if (auto bc = target->activeBuildConfiguration()) {
|
||||
const Utils::Environment environment = bc->environment();
|
||||
const Utils::FilePath emrunPath = environment.searchInPath("emrun");
|
||||
|
||||
QProcess browserLister;
|
||||
@@ -62,12 +63,14 @@ static QStringList detectedBrowsers(ProjectExplorer::Target *target)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
WebBrowserSelectionAspect::WebBrowserSelectionAspect(ProjectExplorer::Target *target)
|
||||
: m_availableBrowsers(detectedBrowsers(target))
|
||||
{
|
||||
if (!m_availableBrowsers.isEmpty())
|
||||
m_currentBrowser = m_availableBrowsers.first();
|
||||
setDisplayName(tr("Web browser"));
|
||||
setId("WebBrowserAspect");
|
||||
@@ -90,6 +93,7 @@ void WebBrowserSelectionAspect::addToConfigurationLayout(QFormLayout *layout)
|
||||
|
||||
void WebBrowserSelectionAspect::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!m_availableBrowsers.isEmpty())
|
||||
m_currentBrowser = map.value(BROWSER_KEY, m_availableBrowsers.first()).toString();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user