qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.42k stars 2.98k forks source link

Crash when I pressed Ctrl-Z keys #55878

Open solisgb opened 8 months ago

solisgb commented 8 months ago

What is the bug or the crash?

In a Layout, I unintentionally deleted a map, I pressed Ctrl-Z, and the error raised

Steps to reproduce the issue

Layout manager Duplicate and rename In the layout, I refreshed the previous map's contents I unintentionally deleted the map I pressed Ctrl-Z Crash

Versions

3.28.14-Firenze

Supported QGIS version

New profile

Additional context

Full crash report:

User Feedback

In a Layout, I unintentionally deleted a map, I pressed Ctrl-Z, and the error raised

Report Details

Python Stack Trace

Windows fatal exception: access violation

Current thread 0x000026bc (most recent call first):
<no Python frame>

Stack Trace


QSortFilterProxyModel::`default constructor closure' :
QSortFilterProxyModel::qt_static_metacall :
QObject::qt_static_metacall :
QAbstractItemModel::dataChanged :
QgsLayoutModel::updateItemSelectStatus :
QgsLayout::deselectAll :
QgsGeoreferencerMainWindow::dragEnterEvent :
QObject::qt_static_metacall :
QgsLayoutUndoStack::undoRedoOccurredForItems :
QgsLayoutUndoStack::indexChanged :
QObject::qt_static_metacall :
QUndoStack::setIndex :
QUndoStack::undo :
QObject::qt_static_metacall :
QAction::activate :
QAction::event :
QApplicationPrivate::notify_helper :
QApplication::notify :
QgsApplication::notify :
QCoreApplication::notifyInternal2 :
QShortcutMap::dispatchEvent :
QShortcutMap::tryShortcut :
QWindowSystemInterface::handleShortcutEvent :
QGuiApplicationPrivate::processKeyEvent :
QWindowSystemInterface::sendWindowSystemEvents :
QEventDispatcherWin32::processEvents :
qt_plugin_query_metadata :
QEventLoop::exec :
QCoreApplication::exec :
main :
BaseThreadInitThunk :
RtlUserThreadStart :

QGIS Info QGIS Version: 3.28.14-Firenze QGIS code revision: b09131c512 Compiled against Qt: 5.15.3 Running against Qt: 5.15.3 Compiled against GDAL: 3.8.2 Running against GDAL: 3.8.2

System Info CPU Type: x86_64 Kernel Type: winnt Kernel Version: 10.0.19045

signedav commented 8 months ago

I've been partly able to reproduce. In my tests it's quite reliable the attributetable only

crashattributetable (missed to have the mouse visible - I always press the undo-button after delete)

I made a supersimple project with a temporary scrash layer without any attributes... undo_attrtable_layout_crash.zip


1  __pthread_kill_implementation                                                                                                                                                                    pthread_kill.c     44   0x7fffee8969fc 
2  __pthread_kill_internal                                                                                                                                                                          pthread_kill.c     78   0x7fffee8969fc 
3  __GI___pthread_kill                                                                                                                                                                              pthread_kill.c     89   0x7fffee8969fc 
4  __GI_raise                                                                                                                                                                                       raise.c            26   0x7fffee842476 
5  __GI_abort                                                                                                                                                                                       abort.c            79   0x7fffee8287f3 
6  qgisCrash                                                                                                                                                                                        main.cpp           362  0x5555555641a9 
7  myMessageOutput                                                                                                                                                                                  main.cpp           449  0x555555564821 
8  ??                                                                                                                                                                                                                       0x7ffff2ec4530 
9  ??                                                                                                                                                                                                                       0x7ffff2ec4649 
10 QMessageLogger::fatal(const char *, ...) const                                                                                                                                                                           0x7ffff2e90b8a 
11 qt_assert_x(const char *, const char *, const char *, int)                                                                                                                                                               0x7ffff2e90052 
12 QgsLayoutFrame::draw                                                                                                                                                                             qgslayoutframe.cpp 177  0x7ffff08b3e09 
13 QgsLayoutItem::paint                                                                                                                                                                             qgslayoutitem.cpp  414  0x7ffff08ba2ae 
14 ??                                                                                                                                                                                                                       0x7ffff40b87b3 
15 ??                                                                                                                                                                                                                       0x7ffff40b9773 
16 ??                                                                                                                                                                                                                       0x7ffff40b9df2 
17 QGraphicsView::paintEvent(QPaintEvent *)                                                                                                                                                                                 0x7ffff40dec3f 
18 QgsLayoutView::paintEvent                                                                                                                                                                        qgslayoutview.cpp  1144 0x7ffff54216ba 
19 QWidget::event(QEvent *)                                                                                                                                                                                                 0x7ffff3daf4ee 
20 QFrame::event(QEvent *)                                                                                                                                                                                                  0x7ffff3e5d422 
21 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *, QEvent *)                                                                                                                                              0x7ffff30b9b9a 
22 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                                                                  0x7ffff3d6c702 
23 QgsApplication::notify                                                                                                                                                                           qgsapplication.cpp 602  0x7ffff04395a3 
24 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                                                                   0x7ffff30b9e3a 
25 QWidgetPrivate::sendPaintEvent(QRegion const&)                                                                                                                                                                           0x7ffff3da743a 
26 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                                                                   0x7ffff3da7c62 
27 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                         0x7ffff3da90a0 
28 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                                                                   0x7ffff3da797c 
29 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                         0x7ffff3da90a0 
30 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                                                                   0x7ffff3da797c 
31 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                         0x7ffff3da90a0 
32 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                                                                   0x7ffff3da797c 
33 QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *, QList<QObject *> const&, int, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                         0x7ffff3da90a0 
34 QWidgetPrivate::drawWidget(QPaintDevice *, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter *, QWidgetRepaintManager *)                                                                   0x7ffff3da797c 
35 ??                                                                                                                                                                                                                       0x7ffff3d7d9f5 
36 QWidget::event(QEvent *)                                                                                                                                                                                                 0x7ffff3dafc3d 
37 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                                                                  0x7ffff3d6c713 
38 QgsApplication::notify                                                                                                                                                                           qgsapplication.cpp 602  0x7ffff04395a3 
39 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                                                                   0x7ffff30b9e3a 
40 QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *)                                                                                                                                                 0x7ffff30bcf27 
41 ??                                                                                                                                                                                                                       0x7ffff40aaf73 
42 QObject::event(QEvent *)                                                                                                                                                                                                 0x7ffff30e741e 
43 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                                                                                                                                                  0x7ffff3d6c713 
44 QgsApplication::notify                                                                                                                                                                           qgsapplication.cpp 602  0x7ffff04395a3 
45 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                                                                                                                                                   0x7ffff30b9e3a 
46 QCoreApplicationPrivate::sendPostedEvents(QObject *, int, QThreadData *)                                                                                                                                                 0x7ffff30bcf27 
47 ??                                                                                                                                                                                                                       0x7ffff3113a67 
48 g_main_context_dispatch                                                                                                                                                                                                  0x7fffe791bd3b 
49 ??                                                                                                                                                                                                                       0x7fffe7971258 
50 g_main_context_iteration                                                                                                                                                                                                 0x7fffe79193e3 
51 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                                               0x7ffff31130b8 
52 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                                                                                                                                                  0x7ffff30b875b 
53 QCoreApplication::exec()                                                                                                                                                                                                 0x7ffff30c0cf4 
54 main                                                                                                                                                                                             main.cpp           1834 0x55555556d6ac 
evinouze commented 5 months ago

Same behaviour with QGIS 3.36.1 running on Linux. Each time I try to click on Cancel button or if press CTRL+Z on keyboard, QGIS crashes. And i don't get any report. QGIS window is just closed and I've to open it again

Version de QGIS 3.36.1-Maidenhead Branche de code de QGIS Release 3.36
Version de Qt 5.15.10
Compiled against Python 3.11.8 Running against Python 3.11.9
Version de GDAL/OGR 3.8.5
Version de Proj 9.4.0
Version de la base de données du registre EPSG v11.004 (2024-02-24)
Version de GEOS 3.12.1-CAPI-1.18.1
Version de SQLite 3.44.2
Version de PDAL 2.5.6
Version du client PostgreSQL unknown
Version de SpatiaLite 5.0.1
Version de QWT 6.1.5
Version de QScintilla2 2.14.1
Version de l'OS KDE Flatpak runtime
       

Extensions Python actives qwc2_tools | v1.0.1 changeDataSource | 3.1 cadastre | 1.19.0 QuickOSM | 2.2.3 trackable_project_files | v1.2.2 idg | 0.2.4 qgis-maptiler-plugin | 3.2 qfieldsync | v4.9.1 menu_from_project | 2.1.0 french_address | 1.3.0 quick_map_services | 0.19.34 db_manager | 0.1.20 processing | 2.12.99

signedav commented 5 months ago

Each time I try to click on Cancel button or if press CTRL+Z on keyboard, QGIS crashes.

Where 'cancel'? And on what elements (everyone or just Attributetable)?

evinouze commented 5 months ago

Where 'cancel'?

Excuse my french. I was talking about this button, when you want to "undo" an operation on your layout image

This occurred several times for any kind of change (after changing a label, moving a legend, etc.)

signedav commented 4 months ago

Checked it out a little bit:

Reproduceable on Attribute Table Item and Fixed Table Item (all heirs of QgsLayoutTable, what is a heir of QgsLayoutMultiFrame).

Crashes in the on draw( itemRenderContext ) -> QgsLayoutFrame::draw where it checks if mMultiFrame (QgsLayoutMultiFrame) exists and if so it tries to receive the frame index - but it does not find the frameIndex (returns -1). There is a QgsLayoutMultiFrame object with mFrameItems, but on recreate, the frame we want to recreate is not contained anymore in mFrameItems (mFrameItems is empty - btw. QgsLayoutMultiFrame is generally quit empty anyway)...

Since the QgsLayoutItemAttributeTable is a QgsLayoutMultiFrame this item is affected here.

Later I found anotehr use case, where it crashes, but somewhere else:

On item->readXml in QgsLayoutItemUndoCommand::restoreState after item = recreateItem( mItemType, mLayout ) - so the item might not be recreated properly.

So it seems that more complex items are not keeped properly in the undoStack - but I'm not too familiar with it....

evinouze commented 6 days ago

I still encounter this issue with QGIS 3.38.3, and it effectively seems to happen when manipulating an attribute table. Does anybody can have some explanations for this trouble?