Navigation Menu

Skip to content

Commit

Permalink
ClientApp: Catch exceptions during shutdown
Browse files Browse the repository at this point in the history
Exception during app initialization would result in a call to the
audio::System that has not been created yet.
  • Loading branch information
skyjake committed Oct 16, 2015
1 parent 31f7e3a commit 8bacbcf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
20 changes: 14 additions & 6 deletions doomsday/apps/client/src/clientapp.cpp
Expand Up @@ -14,7 +14,7 @@
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
* http://www.gnu.org/licenses</small>
*/

#include "de_platform.h"
Expand Down Expand Up @@ -119,7 +119,7 @@ DENG2_PIMPL(ClientApp)
, DENG2_OBSERVES(Plugins, PublishAPI)
, DENG2_OBSERVES(Plugins, Notification)
, DENG2_OBSERVES(Games, Progress)
{
{
Binder binder;
QScopedPointer<Updater> updater;
BusyRunner busyRunner;
Expand Down Expand Up @@ -219,12 +219,20 @@ DENG2_PIMPL(ClientApp)

~Instance()
{
LogBuffer::get().removeSink(logAlarm);
try
{
LogBuffer::get().removeSink(logAlarm);

self.vr().oculusRift().deinit();
self.vr().oculusRift().deinit();

Sys_Shutdown();
DD_Shutdown();
Sys_Shutdown();
DD_Shutdown();
}
catch(Error const &er)
{
qWarning() << "Exception during ~ClientApp:" << er.asText();
DENG2_ASSERT(!"Unclean shutdown: exception in ~ClientApp");
}

updater.reset();
delete worldSys;
Expand Down
9 changes: 6 additions & 3 deletions doomsday/apps/client/src/dd_main.cpp
Expand Up @@ -573,7 +573,10 @@ ::audio::System &App_AudioSystem()
if(App::appExists())
{
#ifdef __CLIENT__
return ClientApp::audioSystem();
if(ClientApp::hasAudioSystem())
{
return ClientApp::audioSystem();
}
#endif
#ifdef __SERVER__
return ServerApp::audioSystem();
Expand Down Expand Up @@ -2392,7 +2395,7 @@ dint DD_GetInteger(dint ddvalue)
case DD_USING_HEAD_TRACKING:
return vrCfg().mode() == VRConfig::OculusRift && vrCfg().oculusRift().isReady();
#endif

case DD_NUMMOBJTYPES:
return ::defs.things.size();

Expand Down Expand Up @@ -2939,7 +2942,7 @@ D_CMD(Version)
LOG_NOTE(_E(D) DOOMSDAY_NICENAME " " DOOMSDAY_VERSION_FULLTEXT);
LOG_MSG(_E(l) "Homepage: " _E(.) _E(i) DOOMSDAY_HOMEURL _E(.)
"\n" _E(l) "Project: " _E(.) _E(i) DENGPROJECT_HOMEURL);

// Print the version info of the current game if loaded.
if(App_GameLoaded())
{
Expand Down

0 comments on commit 8bacbcf

Please sign in to comment.