Hey all,
I was working on some changes to the way the waveform viewer is touched by the rest of the code in mixxx and I stumbled on a segfault bug. It only happens if you are using the simple waveform viewer (i.e. no waveform plotting) and you change the skin. The GUI is warm rebooted, and the widget that handles the waveform is not recreated. In mixxview.cpp createAllWidgets() is called by rebootGUI() when the skin is changed. In the case that the waveform widgets already exist, createAllWidgets just tells the widget to set itself up with the new dimensions/colors, etc. This is fine except the widgets are stored as QObject*'s, and then are casted to WVisualWaveform* to call it's setup() function. The problem is that when we're using simple waveforms, the waveform widget is a WVisualSimple, not a WVisualWaveform.

The special case for a 'warm' boot of the GUI needs to take into account when we are using a WVisualSimple.

I tested this and sure enough it causes a segfault.

steps to reproduce:
1) Run Mixxx, in preferences select 'Simple' waveform viewer.
2) Reboot Mixxx (required when changing waveform viewers)
3) Change the skin

The attached patch should prevent this. That whole section in MixxxView will change once my new waveform stuff gets merged in, but until then we might as well patch this up. (Although I doubt many people use the simple viewer anyway)

Cheers,
RJ
Index: mixxx/src/mixxxview.cpp
===================================================================
--- mixxx/src/mixxxview.cpp	(revision 2048)
+++ mixxx/src/mixxxview.cpp	(working copy)
@@ -507,10 +507,16 @@
             else if (node.nodeName()=="Visual")
             {
                 if (WWidget::selectNodeInt(node, "Channel")==1 && m_pVisualCh1!=0) {
-                    ((WVisualWaveform *)m_pVisualCh1)->setup(node);
-                    ((WVisualWaveform *)m_pVisualCh1)->resetColors();
-                    ((WVisualWaveform *)m_pVisualCh1)->show();
-                    ((WVisualWaveform *)m_pVisualCh1)->repaint();
+		    if(m_bVisualWaveform) {
+			((WVisualWaveform *)m_pVisualCh1)->setup(node);
+			((WVisualWaveform *)m_pVisualCh1)->resetColors();
+			((WVisualWaveform *)m_pVisualCh1)->show();
+			((WVisualWaveform *)m_pVisualCh1)->repaint();
+		    } else {
+			((WVisualSimple *)m_pVisualCh1)->setup(node);
+			((WVisualSimple *)m_pVisualCh1)->show();
+			((WVisualSimple *)m_pVisualCh1)->repaint();
+		    }
                 }
                 else if (WWidget::selectNodeInt(node, "Channel")==1 && m_pVisualCh1==0)
                 {
@@ -542,10 +548,16 @@
                 }
 
                 if (WWidget::selectNodeInt(node, "Channel")==2 && m_pVisualCh2!=0) {
-                    ((WVisualWaveform *)m_pVisualCh2)->setup(node);
-                    ((WVisualWaveform *)m_pVisualCh2)->resetColors();
-                    ((WVisualWaveform *)m_pVisualCh2)->show();
-                    ((WVisualWaveform *)m_pVisualCh2)->repaint();
+		    if(m_bVisualWaveform) {
+			((WVisualWaveform *)m_pVisualCh2)->setup(node);
+			((WVisualWaveform *)m_pVisualCh2)->resetColors();
+			((WVisualWaveform *)m_pVisualCh2)->show();
+			((WVisualWaveform *)m_pVisualCh2)->repaint();
+		    } else {
+			((WVisualSimple *)m_pVisualCh2)->setup(node);
+			((WVisualSimple *)m_pVisualCh2)->show();
+			((WVisualSimple *)m_pVisualCh2)->repaint();
+		    }
                 }
                 else if (WWidget::selectNodeInt(node, "Channel")==2 && m_pVisualCh2==0)
                 {
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to