Lmms: Drag & Drop is broken on QT 5.12

Created on 21 Dec 2018  Â·  25Comments  Â·  Source: LMMS/lmms

Issue

(continuation of https://github.com/LMMS/lmms/issues/4731)

Compiling LMMS with QT 5.11, instrument drag & drop works fine.
Compiling LMMS with QT 5.12:

  • I am able to drag and instrument but not drop it anywhere. The song editor does not accept the drop, cursor is constantly on the "not-allowed" state.
  • LMMS crashes when Ctrl+left dragging patterns.

Crash trace:

Thread 1 "lmms" received signal SIGSEGV, Segmentation fault.
0x00007ffff60a7e26 in QCursor::shape() const () from /usr/lib/libQt5Gui.so.5
(gdb) bt
#0  0x00007ffff60a7e26 in QCursor::shape() const () from /usr/lib/libQt5Gui.so.5
#1  0x00007ffff60d4a29 in QBasicDrag::updateCursor(Qt::DropAction) () from /usr/lib/libQt5Gui.so.5
#2  0x00007ffff153591c in ?? () from /usr/lib/libQt5XcbQpa.so.5
#3  0x00007ffff1536100 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#4  0x00007ffff1538c32 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#5  0x00007ffff60d3766 in QBasicDrag::eventFilter(QObject*, QEvent*) () from /usr/lib/libQt5Gui.so.5
#6  0x00007ffff5cc54db in QCoreApplicationPrivate::sendThroughApplicationEventFilters(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#7  0x00007ffff7a56e72 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#8  0x00007ffff7a5e671 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#9  0x00007ffff5cc58f9 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#10 0x00007ffff60999be in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#11 0x00007ffff609ae26 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#12 0x00007ffff607475c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#13 0x00007ffff152f99c in ?? () from /usr/lib/libQt5XcbQpa.so.5
#14 0x00007ffff48e63cf in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#15 0x00007ffff48e7f89 in ?? () from /usr/lib/libglib-2.0.so.0
#16 0x00007ffff48e7fce in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#17 0x00007ffff5d1b5a9 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#18 0x00007ffff5cc458c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#19 0x00007ffff60d32a6 in QBasicDrag::drag(QDrag*) () from /usr/lib/libQt5Gui.so.5
#20 0x00007ffff60d09c6 in QDragManager::drag(QDrag*) () from /usr/lib/libQt5Gui.so.5
#21 0x00007ffff60d0c8d in QDrag::exec(QFlags<Qt::DropAction>, Qt::DropAction) () from /usr/lib/libQt5Gui.so.5
#22 0x000055555577046f in StringPairDrag::StringPairDrag (this=0x7fffe80095f0, _key=..., _value=..., _icon=..., _w=<optimized out>) at /usr/include/qt/QtCore/qflags.h:120
#23 0x0000555555706d45 in TrackContentObjectView::mouseMoveEvent (this=0x555557f79900, me=0x7fffffffd2c0) at /usr/include/qt/QtCore/qstring.h:976
#24 0x00007ffff7a979d8 in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#25 0x00007ffff7a56e34 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#26 0x00007ffff7a5e8b9 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#27 0x00007ffff5cc58f9 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#28 0x00007ffff7a5db98 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib/libQt5Widgets.so.5
#29 0x00007ffff7ab2d2d in ?? () from /usr/lib/libQt5Widgets.so.5
#30 0x00007ffff7ab5c67 in ?? () from /usr/lib/libQt5Widgets.so.5
#31 0x00007ffff7a56e34 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#32 0x00007ffff7a5e671 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#33 0x00007ffff5cc58f9 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#34 0x00007ffff60999be in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#35 0x00007ffff609ae26 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#36 0x00007ffff607475c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#37 0x00007ffff152f99c in ?? () from /usr/lib/libQt5XcbQpa.so.5
#38 0x00007ffff48e63cf in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#39 0x00007ffff48e7f89 in ?? () from /usr/lib/libglib-2.0.so.0
#40 0x00007ffff48e7fce in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#41 0x00007ffff5d1b5a9 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#42 0x00007ffff5cc458c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#43 0x00007ffff5ccc896 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#44 0x0000555555653689 in main (argc=<optimized out>, argv=<optimized out>) at /home/justas/builds/lmms/src/core/main.cpp:919

Environment

$ uname -a
Linux justas-main 4.19.8-arch1-1-ARCH #1 SMP PREEMPT Sat Dec 8 13:49:11 UTC 2018 x86_64 GNU/Linux
$ ./lmms -v
LMMS 1.2.0-rc7.391
(Linux x86_64, Qt 5.12.0, GCC 8.2.1 20181127)

Possible fix

CYBERDEViLNL has done some testing with 5.12, his findings:
https://github.com/LMMS/lmms/issues/4731#issuecomment-448448881

not our bug

Most helpful comment

All 25 comments

Just tested https://github.com/LMMS/lmms/issues/4731#issuecomment-448448881 patch, instrument drag & drop seems to be working fine!

@CYBERDEViLNL do you want to make a PR or should I?

EDIT: pattern drag & drop still seems to be crashing LMMS.

Well I’m not sure if this is all for Qt 5.12. For example LMMS still crashes on CTRL + Drag a pattern (make a copy of ). I also traced that bug to where LMMS tried to access the cursor while it’s been deleted, I’ve worked around the crash by only calling restoreOverrideCursor if e == NULL in track.cpp TrackContentObjectView::leaveEvent, but this is no good fix only a workaround that will cause issues with the cursor not being restored sometimes.

On the drag ‘patch’, I haven’t experienced issues from that but maybe there need to be some checks first before accepting the event, haven’t duck into it yet that far.

I suggest to wait until response from LMMS member(s) before creating the PR.

Same issue here.

When LMMS crashes under gdb, my mouse cursor becomes completely useless system-wide (can't open menus, click on KDE Application Launcher, etc.) but it can move around. Mouse functionality is restored by typing (gdb) continue and letting the LMMS process die.

Applying both https://github.com/LMMS/lmms/issues/4731#issuecomment-448448881 and the fix suggested by @CYBERDEViLNL seem to fix the problem for me.

As for https://github.com/LMMS/lmms/issues/4731#issuecomment-448448881, I see no reason to have to check before accept()ing the event. I don't see a reason why any parent widgets of the object being dragged would want the event.

What exactly changed between 5.11 and 5.12? If it's something like "handlers are mandatory for all QEvents" then we may want to review the rest of the LMMS source to see if there are any other instances of this issue.

That’s the problem, if we knew what is causing these issues it probably would have been fixed already. I’ve duck into the changelog multiple times already but still not sure.

Changelog: http://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.12.0/?h=v5.12.0

You can use https://bugreports.qt.io/browse/QTBUG to track Qt code changes (after searching for a QTBUG-id like QTBUG-67736 look for Gerrit Reviews (right-bottom) on the bug page).

Also try to do other drag events, like dragging knobs into automation tracks / automation pattern. Keep a eye on the cursor while moving in to not allowed parts again after the move event has been accepted, it stays that way until the cursor leaves the sub-window, which is not how it should be.

@zonkmachine, can you leave a message why you labelled https://github.com/LMMS/lmms/issues/4738 as not our bug?

If this is a LMMS ↔ Qt 5.12 compatibility issue then we should probably address the following:

plugins/vestige/vestige.h:117:  virtual void dragEnterEvent( QDragEnterEvent * _dee );
plugins/vestige/vestige.h:159:  virtual void dragEnterEvent( QDragEnterEvent * _dee );
plugins/patman/patman.h:133:    virtual void dragEnterEvent( QDragEnterEvent * _dee );
plugins/audio_file_processor/audio_file_processor.h:128:    virtual void dragEnterEvent( QDragEnterEvent * _dee );
plugins/zynaddsubfx/ZynAddSubFx.h:144:  virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/Graph.h:87: virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/EnvelopeAndLfoView.h:57:    virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/TrackLabelButton.h:52:  virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/AutomationTrack.h:68:   virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/Knob.h:128: virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/SampleTrack.h:112:  virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/TrackContainerView.h:133:   virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/AutomationPatternView.h:62: virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/AutomationEditor.h:286: virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/InstrumentTrack.h:319:  virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/InstrumentTrack.h:402:  virtual void dragEnterEvent( QDragEnterEvent * _dee );
include/Track.h:252:    virtual void dragEnterEvent( QDragEnterEvent * dee );
include/Track.h:379:    virtual void dragEnterEvent( QDragEnterEvent * dee );
include/Track.h:707:    virtual void dragEnterEvent( QDragEnterEvent * dee );
include/Editor.h:92:    void dragEnterEvent(QDragEnterEvent* event);

@CYBERDEViLNL: I've also noticed that with your patch the cursor dosen't always get reset to the standard pointer image. It has happened a few times, but I can't figure out why/how at the moment.

I wonder if there are times we need to call restoreOverrideCursor() even if e == NULL. There's also a chance I just implemented your fix/workaround incorrectly, here's how I did it:

void TrackContentObjectView::leaveEvent( QEvent * e )
{
    while( QApplication::overrideCursor() != NULL && e == NULL )
    {
        QApplication::restoreOverrideCursor();
    }
    if( e != NULL )
    {
        QWidget::leaveEvent( e );
    }
}

@noahb01 : as stated before this is no fix but only represses the crash symptom, so a workaround.

I’ve implemented a different approach with same result (prevent crash, so still no definite fix), see: https://github.com/CYBERDEViLNL/lmms/commit/b2ba7c883ca04cd9c3d8d69b184b6f4e79dde139

I'm currenly compiling Qt 5.12 for a Ubuntu based distro (mint), to verify this isn't only a Arch thing.

@zonkmachine, can you leave a message why you labelled #4738 as not our bug?

I thought it was a QT issue. There was another issue discussed there at the same time so that may have confused it a bit also. Hack on! 8)

Dragging sliders/knobs to automation tracks is terribly broken with the current workarounds/fixes. As soon as the cursor leaves the window where the control originates, the cursor changes to the 'cant drop here' cursor and cannot be dropped onto an automation track.

I'm guessing that when the cursor leaves the original window, the LMMS root window or whatever is underneath the cursor is accept()ing the DME, and because the root window/song-editior/whatever can't receive a dropped control, it correctly sets the cursor to 'not allowed'. So it seems like we can't blindly accept() DMEs, we're gonna need to make sure that whatever is receiving the DME can actually handle it.

For dragging the automations you need to implement dragMoveEvent in TrackView and TrackContentObjectView in Track.cpp/.h. See: https://github.com/LMMS/lmms/compare/master...CYBERDEViLNL:qt512

I've been experimenting with implementing a clone of StringPairDrag::processDragEnterEvent called it StringPairDrag::processDragMoveEvent it seemed to reduce the cursor issue that the cursor didn’t change back to deny, but it still happened sometimes. Probably forgot something. Will get back to that.

The test where I compiled Qt 5.12 on Linux Mint: had the same issues.

Also if you just want it to run normal again (while there isn’t a good fix yet) on Arch then you can compile with Qt 4.

I thought master dropped support for Qt4? I can't use stable-1.2 because of the veal vs. calf incompatibilities.

Also, the automation-dragging issue still occurs with @CYBERDEViLNL's patches.

This may be unrelated by https://bugreports.qt.io/browse/QTBUG-72795 was opened an hour ago and has to do with drag-and-drop regressions in Qt.

bump.
lmms not working out of the box... (i'm not compiling, i'm just installing it from a repo)
distro: artix linux lxqt
qt package: qt 5.12.0-1 (which is installed by default)
lmms package: 1.2.0rc7-1

drag & drop being broken means the whole program is virtually useless.

workaround
i downloaded lmms-1.2.0-rc7-linux-x86_64.AppImage from https://github.com/LMMS/lmms/releases and that works.

It would be great to fix this issue, as for Arch Linux the package (1.2.0rc7-1) is now in a half-broken state and I will not be able to run against qt 5.11 (we have qt 5.12 in the repos now).
We are tracking this issue downstream in FS#61036.
It would be very beneficial to assign this problem and also add labels to it!

Is there any way to apply the workaround mentioned in QTBUG-72844 to the current code base? I believe this will be the faster and easier solution to this getting a proper fix in qt in the near future (from what I can see).

@hartsantler your comment adds no value to this bug report. If you want to provide your own version of lmms, please promote it elsewhere. However, I agree, that the release status of this project is more than problematic.

Is there any way to apply the workaround mentioned in QTBUG-72844 to the current code base? I believe this will be the faster and easier solution to this getting a proper fix in qt in the near future (from what I can see).

People solve this by either downgrading Qt or by using the AppImage we provide. This seem to work so that's two temporary solutions right there. Then there is the Qt developers who are really working on the issue and will update Qt. This could take maybe a couple of weeks or a month. I don't think we're going to work around this.

Commented today here: https://codereview.qt-project.org/#/c/249086/
Christian Ehrlicher - Change has been successfully cherry-picked to the staging branch.

@zonkmachine thanks for the quick reply!
Yes, then we'll hopefully see the fix in qt 5.12.1.

Fixed in Arch Linux in qt5-base 5.12.0-2

As evidenced by #4789 , it seems to be broken on Arch again in qt5-base 5.12.0-3.
Using the AppImage still works as a workaround for now.

Using arch qt5-base 5.12.0-3.0 and lmms 1.2.0rc7-2 drag and drop works for instrument and plugins, but it doesn't work for ctrl+drag for copying

it doesn't work for ctrl+drag for copying

Hi! Please see https://github.com/LMMS/lmms/issues/4789

Drag and drop is also broken on lmms-1.2.0-rc7 on FreeBSD 12.0 with qt5-5.12.0
No crashes on ctrl+drag, it's just blocked.

This is a known and -- by now well documented -- issue with Qt 5.12.0, this is not an LMMS bug. https://bugreports.qt.io/browse/QTBUG-72844

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gabrielxd195 picture Gabrielxd195  Â·  3Comments

demmm picture demmm  Â·  3Comments

Sawuare picture Sawuare  Â·  3Comments

PaulBatchelor picture PaulBatchelor  Â·  4Comments

softrabbit picture softrabbit  Â·  3Comments