Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGSEGV on cloning pattern #4789

Closed
StinaIsNormallyDistributed opened this issue Jan 22, 2019 · 8 comments · Fixed by #4918
Closed

SIGSEGV on cloning pattern #4789

StinaIsNormallyDistributed opened this issue Jan 22, 2019 · 8 comments · Fixed by #4918
Labels

Comments

@StinaIsNormallyDistributed

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
@Cangle50
Copy link

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.

@dvzrv
Copy link

dvzrv commented Jan 23, 2019

@StinaIsNormallyDistributed seems this is happening on exit:

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

@dvzrv
Copy link

dvzrv commented Jan 23, 2019

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.

@dvzrv
Copy link

dvzrv commented Jan 23, 2019

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

@ghost
Copy link

ghost commented Jan 24, 2019

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;
 		}
 	}

@PhysSong
Copy link
Member

Looks similar to #3926 to me.

@tresf
Copy link
Member

tresf commented Mar 9, 2019

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

@tresf tresf added the bug label Mar 9, 2019
@ghost
Copy link

ghost commented Mar 9, 2019

@tresf nope #4870 won’t 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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants