summaryrefslogtreecommitdiffstats
path: root/src/mixxx.cpp
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/mixxx.cpp
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/mixxx.cpp')
-rw-r--r--src/mixxx.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/mixxx.cpp b/src/mixxx.cpp
index d4bc6e4d12..869ab53db6 100644
--- a/src/mixxx.cpp
+++ b/src/mixxx.cpp
@@ -321,6 +321,7 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {
&PlayerManager::noVinylControlInputConfigured,
this,
&MixxxMainWindow::slotNoVinylControlInputConfigured);
+ PlayerInfo::create();
for (int i = 0; i < kMicrophoneCount; ++i) {
m_pPlayerManager->addMicrophone();