Lmms: SIGSEGV on cloning pattern

Created on 22 Jan 2019  路  8Comments  路  Source: LMMS/lmms

When ctrl-clicking to drag-clone any pattern (beat, pianoroll or automation), lmms segfaults without further error.

lmms 1.2.0-rc7.42
qt5 5.12.0-3
bug

All 8 comments

Looks a little like what was reported in #4738 .

@megahertz commented

Fixed in Arch Linux in qt5-base 5.12.0-2

Looks like qt5 5.12.0-3 has broken it again.

@StinaIsNormallyDistributed seems this is happening on exit:

QPixmap::grabWidget is deprecated, use QWidget::grab() instead
[1]    1168 segmentation fault (core dumped)  lmms

Looking at the QPixmap documentation, this is obsolete since 5.12 and needs to be changed within lmms in these files.
However, this should not lead to a crash (at least not intentionally).
FWIW, it's the same problem with 5.12.0-2.

This seems to trickle down to Qcursor:

Thread 1 "lmms" received signal SIGSEGV, Segmentation fault.
QCursor::shape (this=this@entry=0x0) at kernel/qcursor.cpp:539
539     kernel/qcursor.cpp: No such file or directory.

Don't have much time for a debug build, but might do that in the coming days

While dragging a leaveEvent in TrackContentObjectView is triggered that calls QApplication::restoreOverrideCursor(), that is what is causing the crash.

It won't crash with this patch:

include/Track.h

--- a/include/Track.h
+++ b/include/Track.h
@@ -311,6 +311,7 @@
    bool m_gradient;

    bool m_needsUpdate;
+   bool m_isDragging;
    inline void setInitialMousePos( QPoint pos )
    {
        m_initialMousePos = pos;

src/core/Track.cpp

--- a/src/core/Track.cpp
+++ b/src/core/Track.cpp
@@ -275,7 +275,8 @@
    m_textShadowColor( 0, 0, 0 ),
    m_BBPatternBackground( 0, 0, 0 ),
    m_gradient( true ),
-   m_needsUpdate( true )
+   m_needsUpdate( true ),
+   m_isDragging( false )
 {
    if( s_textFloat == NULL )
    {
@@ -598,9 +599,12 @@
  */
 void TrackContentObjectView::leaveEvent( QEvent * e )
 {
-   while( QApplication::overrideCursor() != NULL )
-   {
-       QApplication::restoreOverrideCursor();
+   if ( ! m_isDragging )
+   {
+       while( QApplication::overrideCursor() != NULL )
+       {
+           QApplication::restoreOverrideCursor();
+       }
    }
    if( e != NULL )
    {
@@ -868,6 +872,8 @@
            // Write the TCOs to the DataFile for copying
            DataFile dataFile = createTCODataFiles( tcoViews );

+           m_isDragging = true;
+
            // TODO -- thumbnail for all selected
            QPixmap thumbnail = grab().scaled(
                128, 128,
@@ -876,6 +882,8 @@
            new StringPairDrag( QString( "tco_%1" ).arg(
                                m_tco->getTrack()->type() ),
                                dataFile.toString(), thumbnail, this );
+
+           m_isDragging = false;
        }
    }

Looks similar to #3926 to me.

@CYBERDEViLNL can you test against #4870 and confirm that it fixes this bug? If so, we'll close it as duplicate of #3926.

@tresf nope https://github.com/LMMS/lmms/pull/4870 won鈥檛 solve this issue. src/core/Track.cpp should be updated for that.

Here is a list of files that probably should be updated to. Only Track.cpp causes troubles with Qt 5.12 but for more clean code I think they all should get a update. I'm willing to work on that, all I need is some time :-P, should a new issue be opened or just continue here for all these files?

src/gui/widgets/LcdSpinBox.cpp:102:     QApplication::setOverrideCursor( Qt::BlankCursor );
src/gui/widgets/Knob.cpp:603:       QApplication::setOverrideCursor( Qt::BlankCursor );
src/gui/editors/PianoRoll.cpp:1602:                 QApplication::setOverrideCursor( c );
src/gui/editors/PianoRoll.cpp:1616:                 QApplication::setOverrideCursor( c );
src/gui/editors/PianoRoll.cpp:2021:         QApplication::setOverrideCursor(
src/gui/editors/PianoRoll.cpp:2239:                     QApplication::setOverrideCursor(QCursor(cursorShape));
src/gui/editors/PianoRoll.cpp:2244:                 QApplication::setOverrideCursor(QCursor(cursorShape));
src/gui/editors/AutomationEditor.cpp:587:               QApplication::setOverrideCursor( c );
src/gui/editors/AutomationEditor.cpp:820:                       QApplication::setOverrideCursor(
src/gui/editors/AutomationEditor.cpp:827:                   QApplication::setOverrideCursor( c );
src/core/Track.cpp:707:         QApplication::setOverrideCursor( c );
src/core/Track.cpp:729:         QApplication::setOverrideCursor( c );
src/core/Track.cpp:941:         QApplication::setOverrideCursor( c );
src/core/Track.cpp:2728:            QApplication::setOverrideCursor( c );
src/core/Track.cpp:2735:            QApplication::setOverrideCursor( c );
Was this page helpful?
0 / 5 - 0 ratings

Related issues

victor00101 picture victor00101  路  3Comments

Gabrielxd195 picture Gabrielxd195  路  3Comments

FigyTuna picture FigyTuna  路  3Comments

Andrewer11 picture Andrewer11  路  3Comments

fentras picture fentras  路  3Comments