nedit-ng icon indicating copy to clipboard operation
nedit-ng copied to clipboard

crash with 2020.1-152-g74ab961

Open marilmanen opened this issue 3 years ago • 9 comments

This time I had a dialog open from a macro command and I was working with other tools. The crash happened at the time when I activated the nedit window. Here is the gdb bt log.

#0  0x00002b75f64a9ce2 in QObjectPrivate::connectImpl(QObject const*, int, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) ()
    at /lib64/libQt5Core.so.5
#1  0x00002b75f64a9f16 in QObject::connectImpl(QObject const*, void**, QObject const*, void**, QtPrivate::QSlotObjectBase*, Qt::ConnectionType, int const*, QMetaObject const*) ()
    at /lib64/libQt5Core.so.5
#2  0x00000000004fd17f in DocumentWidget::resumeMacroExecution() (type=Qt::AutoConnection, slot=..., context=0x2973b10, signal=
    (void (QTimer::*)(QTimer * const, QTimer::QPrivateSignal)) 0x2b75f64b0d40 <QTimer::timeout(QTimer::QPrivateSignal)>, sender=0x6c6468762e696789) at /usr/include/qt5/QtCore/qobject.h:339
#3  0x00000000004fd17f in DocumentWidget::resumeMacroExecution() (this=0x2973b10) at /tools/ext/free/downloads/nedit-ng/src/DocumentWidget.cpp:5400
#4  0x00000000005b87ab in QtPrivate::QFunctorSlotObject<(anonymous namespace)::listDialogMS(DocumentWidget*, Arguments, DataValue*)::<lambda(int)>, 1, QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (__closure=0x24ff570) at /tools/ext/free/downloads/nedit-ng/src/macro.cpp:2962
#5  0x00000000005b87ab in QtPrivate::QFunctorSlotObject<(anonymous namespace)::listDialogMS(DocumentWidget*, Arguments, DataValue*)::<lambda(int)>, 1, QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:130
#6  0x00000000005b87ab in QtPrivate::QFunctorSlotObject<(anonymous namespace)::listDialogMS(DocumentWidget*, Arguments, DataValue*)::<lambda(int)>, 1, QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (arg=<optimized out>, f=...) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:240
#7  0x00000000005b87ab in QtPrivate::QFunctorSlotObject<(anonymous namespace)::listDialogMS(DocumentWidget*, Arguments, DataValue*)::<lambda(int)>, 1, QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=0x24ff560, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/qt5/QtCore/qobject_impl.h:168
#8  0x00002b75f64a4273 in QMetaObject::activate(QObject*, int, int, void**) () at /lib64/libQt5Core.so.5
#9  0x00002b75f5a4d6be in QDialog::finished(int) () at /lib64/libQt5Widgets.so.5
#10 0x00002b75f5a4deb6 in QDialog::done(int) () at /lib64/libQt5Widgets.so.5
#11 0x00002b75f64a4273 in QMetaObject::activate(QObject*, int, int, void**) () at /lib64/libQt5Core.so.5
#12 0x00002b75f59597b2 in QAbstractButton::clicked(bool) () at /lib64/libQt5Widgets.so.5
#13 0x00002b75f59599ea in QAbstractButtonPrivate::emitClicked() () at /lib64/libQt5Widgets.so.5
#14 0x00002b75f595afa3 in QAbstractButtonPrivate::click() () at /lib64/libQt5Widgets.so.5
#15 0x00002b75f595b13d in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /lib64/libQt5Widgets.so.5
#16 0x00002b75f58a11c5 in QWidget::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#17 0x00002b75f5862d8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#18 0x00002b75f586a579 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#19 0x00002b75f647bbe6 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#20 0x00002b75f586941c in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /lib64/libQt5Widgets.so.5
#21 0x00002b75f58ba721 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () at /lib64/libQt5Widgets.so.5
#22 0x00002b75f58bcd65 in QWidgetWindow::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#23 0x00002b75f5862d8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#24 0x00002b75f5869f68 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#25 0x00002b75f647bbe6 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#26 0x00002b75f5e711ed in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib64/libQt5Gui.so.5
#27 0x00002b75f5e72f25 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /lib64/libQt5Gui.so.5
#28 0x00002b75f5e508db in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Gui.so.5
#29 0x00002b75fe89e950 in userEventSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt5XcbQpa.so.5
#30 0x00002b75fad84099 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#31 0x00002b75fad843f8 in g_main_context_iterate.isra.19 () at /lib64/libglib-2.0.so.0
#32 0x00002b75fad844ac in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#33 0x00002b75f64ca45c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#34 0x00002b75f647a6db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#35 0x00002b75f6482c04 in QCoreApplication::exec() () at /lib64/libQt5Core.so.5
#36 0x0000000000497c02 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /tools/ext/free/downloads/nedit-ng/src/nedit.cpp:146

marilmanen avatar Jan 15 '21 04:01 marilmanen

Oh no!

OK, well we'll get to the bottom of it, thanks for the report!

eteran avatar Jan 15 '21 04:01 eteran

Well, since it's hard to reproduce, I kinda have to guess on a solution, but I think I see the issue.

I capture a smart pointer by reference with the intention of both using it and keeping the data it points to alive as long as the connection exists. But by reference is the wrong approach, it should be a copy of the smart pointer so it increments the reference count.

Any chance that you closed a document while a macro was running AND it had a dialog up? I think that that is likely how we could get here.

eteran avatar Jan 15 '21 05:01 eteran

Possibly fixed in master...

eteran avatar Jan 15 '21 05:01 eteran

I have way too much speed to remember what I have done, but most likely I manage to do all kind of weird things. I'll update to the latest and see if I can reproduce the issue.

marilmanen avatar Jan 15 '21 06:01 marilmanen

Something wrong with your latest commit? make[2]: *** [src/CMakeFiles/nedit-ng.dir/DialogMacros.cpp.o] Error 1 make[1]: *** [src/CMakeFiles/nedit-ng.dir/all] Error 2

marilmanen avatar Jan 15 '21 06:01 marilmanen

@marilmanen need qt 5.10 for this. See my post on discussion.

tksoh avatar Jan 15 '21 06:01 tksoh

Oh, I can fix that

eteran avatar Jan 15 '21 13:01 eteran

@marilmanen and @tksoh Should be able to build now

eteran avatar Jan 15 '21 15:01 eteran

Yep, let's see if I can find something new....

marilmanen avatar Jan 15 '21 18:01 marilmanen