https://bugs.kde.org/show_bug.cgi?id=523272

            Bug ID: 523272
           Summary: Undo after closing a project crashes labplot
    Classification: Applications
           Product: LabPlot2
      Version First 2.10.1
       Reported In:
          Platform: Ubuntu
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
Undo after closing a project/worksheet crashes on the freed Worksheet
(use-after-free
in the undo stack)

Does not reproduce in labplot 2.11.0 

STEPS TO REPRODUCE
1. Open a project containing a worksheet (e.g. any project with a
plot/worksheet.
    Reproduced using  `data/example_projects/lake-level.lml` example project.
2. Select the worksheet, then: Worksheet menu (right click) -> Layout -> No
Layout.
   (The undo action becomes enabled.)
3. Project menu -> Close (do not save)
4. Edit menu -> Undo (or Ctrl+Z).

OBSERVED RESULT
LabPlot crashes immediately (SIGSEGV) when Undo is triggered.

EXPECTED RESULT
Undo should either have no effect (since its target worksheet no longer
exists) or should be unavailable/disabled once the worksheet it applies to
has been closed.

SOFTWARE/OS VERSIONS
Operating System: Ubuntu 24.04.04 LTS (noble)
Qt Version: 5.15.2

Backtrace
Thread 1 "labplot2" received signal SIGSEGV, Segmentation fault.
QList<QGraphicsItem*>::QList (this=0x7fffffffca28, l=...) at
/usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:856
856         if (!d->ref.ref()) {
#0  QList<QGraphicsItem*>::QList (this=0x7fffffffca28, l=...) at
/usr/include/x86_64-linux-gnu/qt5/QtCore/qlist.h:856
#1  WorksheetView::selectedItems (this=0x5555564cd1a0) at
src/commonfrontend/worksheet/WorksheetView.cpp:2548
#2  0x00005555557c708a in WorksheetPrivate::updateLayout (this=0x55555635b540,
undoable=true) at src/backend/worksheet/Worksheet.cpp:1554
#3  0x00005555557cece7 in WorksheetSetLayoutCmd::finalize (this=0x5555566c2bb0)
at src/backend/worksheet/Worksheet.cpp:640
#4  0x00007ffff4d3182d in QUndoCommand::undo() () from
/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#5  0x00007ffff4d33682 in QUndoStack::undo() () from
/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#6  0x000055555565d3c4 in MainWin::undo (this=0x555555feda70) at
src/kdefrontend/MainWin.cpp:2258
#7  0x00007ffff3d12dbf in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007ffff4964f94 in QAction::triggered(bool) () from
/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff4967eab in QAction::activate(QAction::ActionEvent) () from
/lib/x86_64-linux-gnu/libQt5Widgets.so.5
    ... (Qt event dispatch frames) ...
#31 0x0000555555648aea in main (argc=2, argv=<optimized out>) at
src/kdefrontend/LabPlot.cpp:258

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to