summaryrefslogtreecommitdiffstats
path: root/src/mixer/playerinfo.h
diff options
context:
space:
mode:
authorJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-08-04 12:24:38 +0200
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2020-08-04 13:14:51 +0200
commita6f59f7766a64cb44a67f02ff1705aaeb7e62b30 (patch)
treea328e00587cdc54c20018faa11c2030e8a2528ae /src/mixer/playerinfo.h
parentcd7c3e0f29862e6eda3b378dd5096f7d1695a708 (diff)
mixer/playerinfo: Make implicit PlayerInfo creation explicit
Until now, the `PlayerInfo` singleton was instantiated implicitly when it was first accessed. This commit makes the instantiation explicit by adding a dedicated `PlayerInfo::create()` method. When running tests directly via `mixxx-test` (i.e. not a via `ctest`), all tests will be executed in the *same* process. Thus, the singleton will be instantiated by the first test that accessses the instance, but stay alive until `mixxx-test` is terminated. The `PlayerInfo` instance will repeatedly call `updateCurrentlyPlayingDeck()` through the `timerEvent()` mehtod during its lifetime. This will access some COs, e.g. `[Master],num_decks`. Depending on the currently running test, these COs may or may not be present. When `QCoreApplication::processEvents()` is called, there might be a `timerEvent()` in the queue and will cause CO access. If the CO is *not* present for that test, the test will throw a `DEBUG_ASSERT`. By making the singleton instantiation more explicit, we can add `PlayerInfo::create()` and `PlayerInfo::destroy()` calls only to the constructor/destructor of text fixtures that need it, and ensure that the timer doesn't cause failed debug assertions in unrelated tests. This fixes the remaining `DEBUG_ASSERT` issues and paves the way for merging PR #2911.
Diffstat (limited to 'src/mixer/playerinfo.h')
-rw-r--r--src/mixer/playerinfo.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mixer/playerinfo.h b/src/mixer/playerinfo.h
index 9a94eb15a6..5aee4fc06c 100644
--- a/src/mixer/playerinfo.h
+++ b/src/mixer/playerinfo.h
@@ -28,6 +28,7 @@
class PlayerInfo : public QObject {
Q_OBJECT
public:
+ static PlayerInfo& create();
static PlayerInfo& instance();
static void destroy();
TrackPointer getTrackInfo(const QString& group);