Bug 457472

Summary: Crash when reloading modified files
Product: [Applications] kdiff3 Reporter: Grósz Dániel <groszdanielpub>
Component: applicationAssignee: michael <reeves.87>
Status: RESOLVED DUPLICATE    
Severity: crash CC: travneff
Priority: NOR    
Version First Reported In: 1.9.5   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi

Description Grósz Dániel 2022-08-04 09:45:27 UTC
Application: kdiff3 (1.9.5 (64 bit))

Qt Version: 5.15.5
Frameworks Version: 5.96.0
Operating System: Linux 5.18.9-2-default x86_64
Windowing System: X11
Distribution: "openSUSE Tumbleweed"
DrKonqi: 5.25.3 [KCrashBackend]

-- Information about the crash:
1. Create two different files. E.g.
echo a > a
echo b > b

2. Compare them with kdiff3.
kdiff3 a b &

3. Modify one or both of the files on the disk. Updating the mtime can be enough. E.g.
touch b

4. In kdiff3, click File/Reload.

Often, kdiff3 will crash.

The crash can be reproduced sometimes.

-- Backtrace:
Application: KDiff3 (kdiff3), signal: Segmentation fault

[KCrash Handler]
#4  Merger::MergeData::MergeData (i=<optimized out>, p=0x408c400000000000, this=0x7ffc1afec230) at /usr/include/c++/12/bits/stl_list.h:354
#5  Merger::MergeData::MergeData (i=0, p=0x408c400000000000, this=0x7ffc1afec230) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/merger.cpp:18
#6  Merger::Merger (pDiffList2=0x0, pDiffList1=0x408c400000000000, this=0x7ffc1afec230) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/merger.cpp:14
#7  DiffTextWindowData::writeLine (this=0x5636594bf380, p=..., pld=0x56365977c448, pLineDiff1=0x408c400000000000, pLineDiff2=0x0, line=..., whatChanged=..., whatChanged2=..., srcLineIdx=..., wrapLineOffset=0, wrapLineLength=0, bWrapLine=false, invalidRect=...) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/difftextwindow.cpp:1029
#8  0x00005636578701ab in DiffTextWindowData::draw (this=0x5636594bf380, p=..., invalidRect=..., beginLine=<optimized out>, endLine=2) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/difftextwindow.cpp:1259
#9  0x00005636578601de in DiffTextWindowData::draw (endLine=<optimized out>, beginLine=<optimized out>, invalidRect=..., p=..., this=<optimized out>) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/difftextwindow.cpp:1173
#10 DiffTextWindow::paintEvent (this=0x5636598e2530, e=<optimized out>) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/difftextwindow.cpp:1180
#11 0x00007fd63326fc68 in QWidget::event (this=0x5636598e2530, event=0x7ffc1afec620) at kernel/qwidget.cpp:9033
#12 0x00007fd63322e41e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5636598e2530, e=0x7ffc1afec620) at kernel/qapplication.cpp:3637
#13 0x00007fd63267ffb8 in QCoreApplication::notifyInternal2 (receiver=0x5636598e2530, event=0x7ffc1afec620) at kernel/qcoreapplication.cpp:1064
#14 0x00007fd633267fc5 in QWidgetPrivate::sendPaintEvent (this=this@entry=0x563659a8b270, toBePainted=...) at kernel/qwidget.cpp:5467
#15 0x00007fd633268881 in QWidgetPrivate::drawWidget (this=this@entry=0x563659a8b270, pdev=0x563659932240, rgn=..., offset=..., flags=flags@entry=..., sharedPainter=sharedPainter@entry=0x0, repaintManager=<optimized out>) at kernel/qwidget.cpp:5417
#16 0x00007fd63323f551 in QWidgetRepaintManager::paintAndFlush (this=0x5636597e1ea0) at kernel/qwidgetrepaintmanager.cpp:1003
#17 0x00007fd63326ff28 in QWidget::event (this=0x5636592d4be0, event=0x5636597801a0) at kernel/qwidget.cpp:8978
#18 0x00007fd633ba67f9 in KXmlGuiWindow::event (this=0x5636592d4be0, ev=0x5636597801a0) at /usr/src/debug/kxmlgui-5.96.0-1.1.x86_64/src/kxmlguiwindow.cpp:220
#19 0x00007fd63322e41e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5636592d4be0, e=0x5636597801a0) at kernel/qapplication.cpp:3637
#20 0x00007fd63267ffb8 in QCoreApplication::notifyInternal2 (receiver=0x5636592d4be0, event=0x5636597801a0) at kernel/qcoreapplication.cpp:1064
#21 0x00007fd632682f51 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x56365915dc90) at kernel/qcoreapplication.cpp:1821
#22 0x00007fd6326d7c53 in postEventSourceDispatch (s=0x5636592ac2a0) at kernel/qeventdispatcher_glib.cpp:277
#23 0x00007fd630bf9ea0 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#24 0x00007fd630bfa258 in ?? () from /lib64/libglib-2.0.so.0
#25 0x00007fd630bfa2ec in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#26 0x00007fd6326d7456 in QEventDispatcherGlib::processEvents (this=0x5636592ba930, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x000056365789e072 in ProgressDialog::recalc (this=0x5636594367f0, bUpdate=<optimized out>) at /usr/include/qt5/QtCore/qflags.h:121
#28 0x0000563657850f6d in ProgressProxy::setInformation (this=0x7ffc1afed000, bRedrawUpdate=true, info=...) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/progress.cpp:611
#29 KDiff3App::mainInit (this=0x56365995f880, pTotalDiffStatus=0x5636598e98e0, inFlags=...) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/pdiff.cpp:127
#30 0x00007fd6326b6e6f in QtPrivate::QSlotObjectBase::call (a=0x7ffc1afed170, r=0x56365995f880, this=0x563659648ae0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#31 doActivate<false> (sender=0x563659429180, signal_index=4, argv=0x7ffc1afed170) at kernel/qobject.cpp:3886
#32 0x00007fd6326b022f in QMetaObject::activate (sender=sender@entry=0x563659429180, m=m@entry=0x7fd633742d20, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffc1afed170) at kernel/qobject.cpp:3946
#33 0x00007fd633227bb2 in QAction::triggered (this=this@entry=0x563659429180, _t1=<optimized out>) at .moc/moc_qaction.cpp:376
#34 0x00007fd63322a71b in QAction::activate (this=0x563659429180, event=<optimized out>) at kernel/qaction.cpp:1161
#35 0x00007fd6333af272 in QMenuPrivate::activateCausedStack (this=this@entry=0x563659614c60, causedStack=..., action=action@entry=0x563659429180, action_e=action_e@entry=QAction::Trigger, self=self@entry=true) at widgets/qmenu.cpp:1384
#36 0x00007fd6333b70d4 in QMenuPrivate::activateAction (this=0x563659614c60, action=0x563659429180, action_e=QAction::Trigger, self=<optimized out>) at widgets/qmenu.cpp:1461
#37 0x00007fd63326fc68 in QWidget::event (this=0x56365960d620, event=0x7ffc1afed750) at kernel/qwidget.cpp:9033
#38 0x00007fd63322e41e in QApplicationPrivate::notify_helper (this=this@entry=0x56365915f8c0, receiver=receiver@entry=0x56365960d620, e=e@entry=0x7ffc1afed750) at kernel/qapplication.cpp:3637
#39 0x00007fd633236942 in QApplication::notify (this=<optimized out>, receiver=0x56365960d620, e=<optimized out>) at kernel/qapplication.cpp:3081
#40 0x00007fd63267ffb8 in QCoreApplication::notifyInternal2 (receiver=0x56365960d620, event=0x7ffc1afed750) at kernel/qcoreapplication.cpp:1064
#41 0x00007fd633234abe in QApplicationPrivate::sendMouseEvent (receiver=0x56365960d620, event=event@entry=0x7ffc1afed750, alienWidget=<optimized out>, nativeWidget=0x56365960d620, buttonDown=buttonDown@entry=0x7fd63377a330 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2619
#42 0x00007fd633288ed5 in QWidgetWindow::handleMouseEvent (this=0x7fd628006630, event=0x7ffc1afeda00) at kernel/qwidgetwindow.cpp:580
#43 0x00007fd63328bfe0 in QWidgetWindow::event (this=0x7fd628006630, event=0x7ffc1afeda00) at kernel/qwidgetwindow.cpp:300
#44 0x00007fd63322e41e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x7fd628006630, e=0x7ffc1afeda00) at kernel/qapplication.cpp:3637
#45 0x00007fd63267ffb8 in QCoreApplication::notifyInternal2 (receiver=0x7fd628006630, event=0x7ffc1afeda00) at kernel/qcoreapplication.cpp:1064
#46 0x00007fd632ae09b5 in QGuiApplicationPrivate::processMouseEvent (e=0x563659a1abd0) at kernel/qguiapplication.cpp:2282
#47 0x00007fd632ab433c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#48 0x00007fd62db637fa in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#49 0x00007fd630bf9ea0 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#50 0x00007fd630bfa258 in ?? () from /lib64/libglib-2.0.so.0
#51 0x00007fd630bfa2ec in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#52 0x00007fd6326d7456 in QEventDispatcherGlib::processEvents (this=0x5636592ba930, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#53 0x00007fd63267ea2b in QEventLoop::exec (this=this@entry=0x7ffc1afedd30, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#54 0x00007fd632686b96 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#55 0x00007fd632ad3e0c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1867
#56 0x00007fd63322e395 in QApplication::exec () at kernel/qapplication.cpp:2829
#57 0x00005636578247a3 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kdiff3-1.9.5-1.4.x86_64/src/main.cpp:193
[Inferior 1 (process 10300) detached]

Reported using DrKonqi (well, not exactly: DrKonqi "failed to submit bug report", so I'm copying here its output that I'd fortunately copied)
Comment 1 Andrew 2023-02-06 18:48:12 UTC
Created attachment 156003 [details]
New crash information added by DrKonqi

kdiff3 (1.9.6 (64 bit)) using Qt 5.15.8

Also got a crash while reloading modified files.

Fedora 37 x64

kdiff3-1.9.6-2.fc37.x86_64
glibc-2.36-9.fc37.x86_64
kf5-kcoreaddons-5.102.0-1.fc37.x86_64
kf5-kio-core-libs-5.102.0-1.fc37.x86_64
kf5-kitemviews-5.102.0-1.fc37.x86_64
kf5-kjobwidgets-5.102.0-1.fc37.x86_64
kf5-kparts-5.102.0-1.fc37.x86_64
kf5-kservice-5.102.0-1.fc37.x86_64
kf5-kwidgetsaddons-5.102.0-1.fc37.x86_64
kf5-kwindowsystem-5.102.0-1.fc37.x86_64
libselinux-3.4-5.fc37.x86_64
libstdc++-12.2.1-4.fc37.x86_64
libX11-1.8.1-2.fc37.x86_64
libxcb-1.13.1-10.fc37.x86_64
libXext-1.3.4-9.fc37.x86_64
libxkbcommon-1.4.1-2.fc37.x86_64
qt5-qtbase-5.15.8-2.fc37.x86_64
qt5-qtx11extras-5.15.8-1.fc37.x86_64

-- Backtrace (Reduced):
#4  0x000056038396317f in LineData::getLine() const ()
#5  0x000056038396431d in DiffTextWindowData::writeLine(RLPainter&, LineData const*, DiffList const*, DiffList const*, LineRef const&, QFlags<ChangeFlag>, QFlags<ChangeFlag>, LineRef const&, int, int, bool, QRect const&) ()
#7  0x0000560383963066 in DiffTextWindow::paintEvent(QPaintEvent*) ()
#8  0x00007f55fcbf1938 in QWidget::event(QEvent*) () from /lib64/libQt5Widgets.so.5
#9  0x00007f55fcbaed62 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5
Comment 2 michael 2023-02-12 19:04:01 UTC
 Unable to reproduce on current master or 1.10.0 branch.  Both run valgrind clean when reloading indicating no memory access issues. "undefined;address" sanitizers pass as well.
Comment 3 michael 2023-03-03 20:10:41 UTC
Looks like its related to 466524 intermittent crash on reload in general.

*** This bug has been marked as a duplicate of bug 466524 ***