Skip to content

Commit

Permalink
Merge pull request mixxxdj#2 from daschuer/vumeter_qglwidget_2
Browse files Browse the repository at this point in the history
Segfault Fix
  • Loading branch information
m0dB committed Sep 29, 2022
2 parents 4a1140e + c9af1e0 commit 0175001
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 12 deletions.
1 change: 1 addition & 0 deletions res/skins/Shade/auxiliary.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<WidgetGroup>
<Pos>99,14</Pos>
<Size>5f,35f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>auxiliary_VuMeter</TooltipId>
Expand Down
1 change: 1 addition & 0 deletions res/skins/Shade/microphone.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<WidgetGroup>
<Pos>82,14</Pos>
<Size>5f,35f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>microphone_VuMeter</TooltipId>
Expand Down
21 changes: 21 additions & 0 deletions res/skins/Shade/mixer_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@
<WidgetGroup>
<Pos>113,28</Pos>
<Size>26f,1f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<Style>WVuMeter { background-color: #626f87; }</Style>
Expand Down Expand Up @@ -798,6 +799,7 @@
<WidgetGroup>
<Pos>107,76</Pos>
<Size>5f,81f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>channel_VuMeter</TooltipId>
Expand All @@ -808,6 +810,10 @@
<PeakHoldTime>500</PeakHoldTime>
<PeakFallTime>50</PeakFallTime>
<PeakFallStep>2</PeakFallStep>
<Channel>1</Channel>
<PathBackground scalemode="STRETCH_ASPECT">vinyl_spinny_background.png</PathBackground>
<PathForeground scalemode="STRETCH_ASPECT">vinyl_spinny_foreground.png</PathForeground>
<PathGhost scalemode="STRETCH_ASPECT">vinyl_spinny_foreground_ghost.png</PathGhost>
<Connection>
<ConfigKey>[Channel1],VuMeter</ConfigKey>
</Connection>
Expand All @@ -817,6 +823,7 @@
<WidgetGroup>
<Pos>143,76</Pos>
<Size>5f,81f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>channel_VuMeter</TooltipId>
Expand All @@ -827,6 +834,10 @@
<PeakHoldTime>500</PeakHoldTime>
<PeakFallTime>50</PeakFallTime>
<PeakFallStep>2</PeakFallStep>
<Channel>1</Channel>
<PathBackground scalemode="STRETCH_ASPECT">vinyl_spinny_background.png</PathBackground>
<PathForeground scalemode="STRETCH_ASPECT">vinyl_spinny_foreground.png</PathForeground>
<PathGhost scalemode="STRETCH_ASPECT">vinyl_spinny_foreground_ghost.png</PathGhost>
<Connection>
<ConfigKey>[Channel2],VuMeter</ConfigKey>
</Connection>
Expand All @@ -836,6 +847,7 @@
<WidgetGroup>
<Pos>122,76</Pos>
<Size>5f,81f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>master_VuMeterL</TooltipId>
Expand All @@ -845,6 +857,10 @@
<PeakHoldTime>500</PeakHoldTime>
<PeakFallTime>50</PeakFallTime>
<PeakFallStep>2</PeakFallStep>
<Channel>1</Channel>
<PathBackground scalemode="STRETCH_ASPECT">vinyl_spinny_background.png</PathBackground>
<PathForeground scalemode="STRETCH_ASPECT">vinyl_spinny_foreground.png</PathForeground>
<PathGhost scalemode="STRETCH_ASPECT">vinyl_spinny_foreground_ghost.png</PathGhost>
<Connection>
<ConfigKey>[Master],VuMeterL</ConfigKey>
</Connection>
Expand All @@ -854,6 +870,7 @@
<WidgetGroup>
<Pos>128,76</Pos>
<Size>5f,81f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>master_VuMeterR</TooltipId>
Expand All @@ -863,6 +880,10 @@
<PeakHoldTime>500</PeakHoldTime>
<PeakFallTime>50</PeakFallTime>
<PeakFallStep>2</PeakFallStep>
<Channel>1</Channel>
<PathBackground scalemode="STRETCH_ASPECT">vinyl_spinny_background.png</PathBackground>
<PathForeground scalemode="STRETCH_ASPECT">vinyl_spinny_foreground.png</PathForeground>
<PathGhost scalemode="STRETCH_ASPECT">vinyl_spinny_foreground_ghost.png</PathGhost>
<Connection>
<ConfigKey>[Master],VuMeterR</ConfigKey>
</Connection>
Expand Down
1 change: 1 addition & 0 deletions res/skins/Shade/preview_deck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@
<WidgetGroup>
<Pos>2,11</Pos>
<Size>5f,41f</Size>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>sampler_VuMeter</TooltipId>
Expand Down
1 change: 1 addition & 0 deletions res/skins/Shade/sampler.xml
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@
</StatusLight>
<WidgetGroup>
<Pos>3,24</Pos>
<Layout>horizontal</Layout>
<Children>
<VuMeter>
<TooltipId>sampler_VuMeter</TooltipId>
Expand Down
38 changes: 26 additions & 12 deletions src/skin/legacy/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1269,22 +1269,29 @@ QWidget* LegacySkinParser::parseSpinny(const QDomElement& node) {
SKIN_WARNING(node, *m_pContext) << "No player found for group:" << group;
return nullptr;
}
WSpinny* spinny = new WSpinny(m_pParent, group, m_pConfig, m_pVCManager, pPlayer);
commonWidgetSetup(node, spinny);
// Note: For some reasons we need to create the widget without a parent to avoid to
// create two platform windows in QWidget::create() for this widget.
// This happens, because the QWidget::create() of a parent() will populate all children
// with platform windows q_createNativeChildrenAndSetParent() while another window is already
// under construction. The ID for the first window is not cleared and leads to a segfault
// during on shutdown
WSpinny* pSpinny = new WSpinny(nullptr, group, m_pConfig, m_pVCManager, pPlayer);
pSpinny->setParent(m_pParent);
commonWidgetSetup(node, pSpinny);

connect(waveformWidgetFactory,
&WaveformWidgetFactory::renderSpinnies,
spinny,
pSpinny,
&WSpinny::render);
connect(waveformWidgetFactory, &WaveformWidgetFactory::swapSpinnies, spinny, &WSpinny::swap);
connect(spinny, &WSpinny::trackDropped, m_pPlayerManager, &PlayerManager::slotLoadToPlayer);
connect(spinny, &WSpinny::cloneDeck, m_pPlayerManager, &PlayerManager::slotCloneDeck);
connect(waveformWidgetFactory, &WaveformWidgetFactory::swapSpinnies, pSpinny, &WSpinny::swap);
connect(pSpinny, &WSpinny::trackDropped, m_pPlayerManager, &PlayerManager::slotLoadToPlayer);
connect(pSpinny, &WSpinny::cloneDeck, m_pPlayerManager, &PlayerManager::slotCloneDeck);

spinny->setup(node, *m_pContext);
spinny->installEventFilter(m_pKeyboard);
spinny->installEventFilter(m_pControllerManager->getControllerLearningEventFilter());
spinny->Init();
return spinny;
pSpinny->setup(node, *m_pContext);
pSpinny->installEventFilter(m_pKeyboard);
pSpinny->installEventFilter(m_pControllerManager->getControllerLearningEventFilter());
pSpinny->Init();
return pSpinny;
}

QWidget* LegacySkinParser::parseVuMeter(const QDomElement& node) {
Expand Down Expand Up @@ -1312,7 +1319,14 @@ QWidget* LegacySkinParser::parseVuMeter(const QDomElement& node) {
dummy->setText(tr("No OpenGL\nsupport."));
return dummy;
}
WVuMeterGL* pVuMeterWidget = new WVuMeterGL(m_pParent);
// Note: For some reasons we need to create the widget without a parent to avoid to
// create two platform windows in QWidget::create() for this widget.
// This happens, because the QWidget::create() of a parent() will populate all children
// with platform windows q_createNativeChildrenAndSetParent() while another window is already
// under construction. The ID for the first window is not cleared and leads to a segfault
// during on shutdown
WVuMeterGL* pVuMeterWidget = new WVuMeterGL();
pVuMeterWidget->setParent(m_pParent);
commonWidgetSetup(node, pVuMeterWidget);

waveformWidgetFactory->addVuMeter(pVuMeterWidget);
Expand Down

0 comments on commit 0175001

Please sign in to comment.