diff base/Debug.cpp @ 1251:67aee57e32c8 3.0-integration

Merge from branch piper
author Chris Cannam
date Fri, 04 Nov 2016 14:57:03 +0000
parents 8f076d02569a
children ad2d3e0a8b7c
line wrap: on
line diff
--- a/base/Debug.cpp	Tue Nov 01 14:06:47 2016 +0000
+++ b/base/Debug.cpp	Fri Nov 04 14:57:03 2016 +0000
@@ -21,7 +21,7 @@
 #include <QUrl>
 #include <QCoreApplication>
 
-#ifndef NDEBUG
+#include <stdexcept>
 
 static SVDebug *debug = 0;
 static QMutex mutex;
@@ -40,6 +40,11 @@
     m_ok(false),
     m_eol(false)
 {
+    if (qApp->applicationName() == "") {
+        cerr << "ERROR: Can't use SVDEBUG before setting application name" << endl;
+        throw std::logic_error("Can't use SVDEBUG before setting application name");
+    }
+    
     QString pfx = ResourceFinder().getUserResourcePrefix();
     QDir logdir(QString("%1/%2").arg(pfx).arg("log"));
 
@@ -76,8 +81,6 @@
     return dbg;
 }
 
-#endif
-
 std::ostream &
 operator<<(std::ostream &target, const QString &str)
 {