diff data/midi/MIDIEvent.h @ 1848:98339fac0faf

Avoid returning expired pointers
author Chris Cannam
date Thu, 23 Apr 2020 15:39:08 +0100
parents c3b5564cfb78
children
line wrap: on
line diff
--- a/data/midi/MIDIEvent.h	Wed Apr 22 17:18:33 2020 +0100
+++ b/data/midi/MIDIEvent.h	Thu Apr 23 15:39:08 2020 +0100
@@ -228,7 +228,9 @@
     virtual ~MIDIException() throw() { }
 
     const char *what() const throw() override {
-        return m_message.toLocal8Bit().data();
+        static QByteArray msg;
+        msg = m_message.toLocal8Bit();
+        return msg.data();
     }
 
 protected: