summaryrefslogtreecommitdiffstats
path: root/audio/flacon/audioformat_segfault.diff
blob: a2360bd71c28cf9f31d191a7f7eb6d3381c3b4e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
diff --git a/formats/format.cpp b/formats/format.cpp
index 53f7ed0..89abaf9 100644
--- a/formats/format.cpp
+++ b/formats/format.cpp
@@ -32,7 +32,14 @@
 #include <QByteArray>
 #include <QFile>
 
-AudioFormatList AudioFormat::mAllFormats;
+/************************************************
+ *
+ ************************************************/
+AudioFormatList &formatList()
+{
+    static AudioFormatList *afl = new AudioFormatList();
+    return *afl;
+}
 
 
 /************************************************
@@ -43,9 +50,9 @@ bool AudioFormat::registerFormat(const AudioFormat &f)
     // Some formats can be embedded as a chunk of RIFF stream.
     // So the WAV format should be last and be checked in the last turn.
     if (f.ext() == "wav")
-        mAllFormats.append(&f);
+        formatList().append(&f);
     else
-        mAllFormats.insert(0, &f);
+        formatList().insert(0, &f);
     return true;
 }
 
@@ -71,7 +78,7 @@ AudioFormat::~AudioFormat()
  ************************************************/
 const AudioFormatList &AudioFormat::allFormats()
 {
-    return mAllFormats;
+    return formatList();
 }
 
 
diff --git a/formats/format.h b/formats/format.h
index b159b7a..0f9fcb6 100644
--- a/formats/format.h
+++ b/formats/format.h
@@ -70,8 +70,6 @@ class AudioFormat
 protected:
     virtual bool checkMagic(const QByteArray &data) const;
 
-private:
-    static QList<const AudioFormat*> mAllFormats;
 };
 
 
@@ -79,6 +77,6 @@ class AudioFormat
 
 #define REGISTER_FORMAT(FORMAT) \
     static FORMAT static_##FORMAT##_Instance; \
-    static bool  is_##FORMAT##_loaded = AudioFormat::registerFormat(static_##FORMAT##_Instance);
+    static bool is_##FORMAT##_loaded = AudioFormat::registerFormat(static_##FORMAT##_Instance);
 
 #endif // FORMAT_H