Navigation Menu

Skip to content

Commit

Permalink
Fixed|Unix: Crash when launching application (UnixInfo)
Browse files Browse the repository at this point in the history
UnixInfo needed to know the application's /etc path, but the application
had not been fully constructed at the time.
  • Loading branch information
skyjake committed Feb 25, 2014
1 parent d0390a8 commit d0b0ad5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions doomsday/libdeng2/src/core/app.cpp
Expand Up @@ -76,7 +76,7 @@ DENG2_PIMPL(App)
/// The archive is owned by the file system.
Archive *persistentData;

UnixInfo unixInfo;
QScopedPointer<UnixInfo> unixInfo;

/// The configuration.
Config *config;
Expand Down Expand Up @@ -226,6 +226,8 @@ DENG2_PIMPL(App)
App::App(NativePath const &appFilePath, QStringList args)
: d(new Instance(this, args))
{
d->unixInfo.reset(new UnixInfo);

// Global time source for animations.
Animation::setClock(&d->clock);

Expand Down Expand Up @@ -334,7 +336,7 @@ NativePath App::nativePluginBinaryPath()
path = DENG_LIBRARY_DIR;
# endif
// Also check the system config files.
d->unixInfo.path("libdir", path);
d->unixInfo->path("libdir", path);
#endif
return (d->cachedPluginBinaryPath = path);
}
Expand Down Expand Up @@ -401,7 +403,7 @@ NativePath App::nativeBasePath()
path = DENG_BASE_DIR;
# endif
// Also check the system config files.
d->unixInfo.path("basedir", path);
d->unixInfo->path("basedir", path);
#endif
return (d->cachedBasePath = path);
}
Expand Down Expand Up @@ -518,6 +520,7 @@ bool App::appExists()

App &App::app()
{
DENG2_ASSERT(appExists());
return *singletonApp;
}

Expand Down Expand Up @@ -571,7 +574,7 @@ Config &App::config()

UnixInfo &App::unixInfo()
{
return DENG2_APP->d->unixInfo;
return *DENG2_APP->d->unixInfo;
}

} // namespace de

0 comments on commit d0b0ad5

Please sign in to comment.