Bug 392753 - Crash when opening a report
Summary: Crash when opening a report
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Reports and Printouts (show other bugs)
Version: 3.1.0
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: 3.2
Assignee: Jarosław Staniek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-05 11:39 UTC by Ray
Modified: 2023-09-03 20:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.2


Attachments
Database showing bug. (320.00 KB, application/x-sqlite3)
2018-04-05 11:39 UTC, Ray
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ray 2018-04-05 11:39:29 UTC
Created attachment 111841 [details]
Database showing bug.

Crashes when trying to open the report in the atachment.
I tried to make a simple example showing the problem but the simple examples always work correctly. So attaching my database. This was created by importing CSV tables out of LibreOffice and making a query and report. I experienced several other crashes in the process but difficult to say exactly what sequence of events triggered them.
Comment 1 Jarosław Staniek 2018-04-05 12:24:56 UTC
Thank you very much Ray.
Comment 2 Adam Pigg 2018-04-05 17:34:07 UTC
#0  0x00007ffff6dcecf7 in std::__atomic_base<int>::load (__m=std::memory_order_relaxed, this=0x21) at /usr/include/c++/7/bits/atomic_base.h:396
#1  QAtomicOps<int>::load<int> (_q_value=...) at /usr/include/qt5/QtCore/qatomic_cxx11.h:227
#2  0x00007ffff6dcec2c in QBasicAtomicInteger<int>::load (this=0x21) at /usr/include/qt5/QtCore/qbasicatomic.h:102
#3  0x00007ffff6dce92c in QtPrivate::RefCount::ref (this=0x21) at /usr/include/qt5/QtCore/qrefcount.h:55
#4  0x00007ffff6dcea67 in QString::QString (this=0x7fffffffb148, other=...) at /usr/include/qt5/QtCore/qstring.h:942
#5  0x00007ffff6e36c82 in KDbQueryColumnInfo::alias (this=0x92f190) at /home/piggz/src/kdb/src/KDbQueryColumnInfo.cpp:81
#6  0x00007ffff6e2375c in KDbOrderByColumn::toSqlString (this=0xedd4e0, includeTableName=true, conn=0x989420, escapingType=KDb::DriverEscaping) at /home/piggz/src/kdb/src/KDbOrderByColumn.cpp:186
#7  0x00007ffff6e246e7 in KDbOrderByColumnList::toSqlString (this=0xedae70, includeTableNames=true, conn=0x989420, escapingType=KDb::DriverEscaping) at /home/piggz/src/kdb/src/KDbOrderByColumn.cpp:400
#8  0x00007ffff6e9f6ba in selectStatementInternal (target=0x7fffffffbd80, connection=0x989420, dialect=KDb::DriverEscaping, querySchema=0xedab90, options=..., parameters=...) at /home/piggz/src/kdb/src/KDbNativeStatementBuilder.cpp:392
#9  0x00007ffff6e9fb65 in KDbNativeStatementBuilder::generateSelectStatement (this=0x7fffffffbd98, target=0x7fffffffbd80, querySchema=0xedab90, parameters=...) at /home/piggz/src/kdb/src/KDbNativeStatementBuilder.cpp:434
#10 0x00007fffcda7d150 in KRScriptFunctions::KRScriptFunctions (this=0x9b5b80, datasource=0xeda900, conn=0x989420) at /home/piggz/src/kexi/src/plugins/reports/krscriptfunctions.cpp:39
#11 0x00007fffcda76e02 in KexiReportView::afterSwitchFrom (this=0xe94ee0, mode=Kexi::AllViewModes) at /home/piggz/src/kexi/src/plugins/reports/kexireportview.cpp:377
#12 0x00007ffff78086f6 in KexiWindow::switchToViewMode (this=0xe8cc30, newViewMode=Kexi::DataViewMode, staticObjectArgs=0x0, proposeOpeningInTextViewModeBecauseOfProblems=0x7fffffffc0cf) at /home/piggz/src/kexi/src/core/KexiWindow.cpp:549
#13 0x00007ffff7819d80 in KexiPart::Part::openInstance (this=0x9e68e0, parent=0xe7d260, item=0xc77450, viewMode=Kexi::DataViewMode, staticObjectArgs=0x0) at /home/piggz/src/kexi/src/core/kexipart.cpp:288
#14 0x00007ffff77fc822 in KexiProject::openObject (this=0x90de90, parent=0xe7d260, item=0xc77450, viewMode=Kexi::DataViewMode, staticObjectArgs=0x0) at /home/piggz/src/kexi/src/core/kexiproject.cpp:967
#15 0x00007ffff7ac9b3f in KexiMainWindow::openObject (this=0x757990, item=0xc77450, viewMode=Kexi::DataViewMode, openingCancelled=0x7fffffffc54f, staticObjectArgs=0x0, errorMessage=0x0)
    at /home/piggz/src/kexi/src/main/KexiMainWindow.cpp:3274
#16 0x00007ffff7aca243 in KexiMainWindow::openObjectFromNavigator (this=0x757990, item=0xc77450, viewMode=Kexi::DataViewMode, openingCancelled=0x7fffffffc54f) at /home/piggz/src/kexi/src/main/KexiMainWindow.cpp:3378
#17 0x00007ffff7ac9fda in KexiMainWindow::openObjectFromNavigator (this=0x757990, item=0xc77450, viewMode=Kexi::DataViewMode) at /home/piggz/src/kexi/src/main/KexiMainWindow.cpp:3337
#18 0x00007ffff7b2938b in KexiMainWindow::qt_static_metacall (_o=0x757990, _c=QMetaObject::InvokeMetaMethod, _id=51, _a=0x7fffffffc850) at /home/piggz/src/kexi-build/src/main/keximain_autogen/EWIEGA46WW/moc_KexiMainWindow.cpp:678
#19 0x00007ffff291826a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#20 0x00007ffff1731582 in KexiProjectNavigator::openOrActivateItem (this=0x9a7460, _t1=0xc77450, _t2=Kexi::DataViewMode) at /home/piggz/src/kexi-build/src/widget/kexiextendedwidgets_autogen/RU47RH5TZY/moc_KexiProjectNavigator.cpp:556
#21 0x00007ffff16ed409 in KexiProjectNavigator::slotExecuteItem (this=0x9a7460, vitem=...) at /home/piggz/src/kexi/src/widget/navigator/KexiProjectNavigator.cpp:331
#22 0x00007ffff1730e4f in KexiProjectNavigator::qt_static_metacall (_o=0x9a7460, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0x7fffffffcaa0)
    at /home/piggz/src/kexi-build/src/widget/kexiextendedwidgets_autogen/RU47RH5TZY/moc_KexiProjectNavigator.cpp:415
#23 0x00007ffff291826a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#24 0x00007ffff41f2cd5 in QAbstractItemView::doubleClicked(QModelIndex const&) () from /usr/lib64/libQt5Widgets.so.5
#25 0x00007ffff425f113 in QTreeView::mouseDoubleClickEvent(QMouseEvent*) () from /usr/lib64/libQt5Widgets.so.5
#26 0x00007ffff3ffecb9 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#27 0x00007ffff409c1ee in QFrame::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#28 0x00007ffff41fe04c in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#29 0x00007ffff426106c in QTreeView::viewportEvent(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#30 0x00007ffff28e9e54 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#31 0x00007ffff3fc1ff5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#32 0x00007ffff3fc986f in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#33 0x00007ffff28ea148 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#34 0x00007ffff3fc88bf in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQt5Widgets.so.5
#35 0x00007ffff401868b in ?? () from /usr/lib64/libQt5Widgets.so.5
#36 0x00007ffff401aab1 in ?? () from /usr/lib64/libQt5Widgets.so.5
#37 0x00007ffff3fc201c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#38 0x00007ffff3fc9314 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#39 0x00007ffff28ea148 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#40 0x00007ffff30fe25f in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib64/libQt5Gui.so.5
#41 0x00007ffff30ffa15 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib64/libQt5Gui.so.5
#42 0x00007ffff30d8eab in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Gui.so.5
#43 0x00007fffe2ef078b in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#44 0x00007ffff28e895a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#45 0x00007ffff28f1494 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#46 0x0000000000400f72 in main (argc=2, argv=0x7fffffffd938) at /home/piggz/src/kexi/src/main.cpp:36
Comment 3 Jarosław Staniek 2018-05-16 08:16:35 UTC
Git commit 3414fbddffa433b23d43376b44fef5421b734250 by Jaroslaw Staniek.
Committed on 16/05/2018 at 08:15.
Pushed by staniek into branch 'master'.

Fix handling ORDER BY part of queries

Summary:
- new APIs
- maintain relations between connections, queries and column infos
- fix cloning queries with ORDER BY
- update and add autotests

FIXED-IN:3.2
Related: bug 393705

Test Plan:
Required: KEXI & KDb 3.2 (current master)

Test 1: Open report and query from https://bugs.kde.org/show_bug.cgi?id=392753#c0 in design and data views.
Expected: works, no crashes

Test 2: Try these on a standard Persons and Cars test:
select id from cars order by owner;
select id from cars order by owner, model, id;
select id, model from cars order by 2, 1;

Expected: works, no crash

Reviewers: piggz

Reviewed By: piggz

Subscribers: Kexi-Devel-list

Tags: #kdb

Differential Revision: https://phabricator.kde.org/D12873

M  +1    -1    CMakeLists.txt
M  +3    -0    autotests/CMakeLists.txt
A  +212  -0    autotests/OrderByColumnTest.cpp     [License: LGPL (v2+)]
A  +46   -0    autotests/OrderByColumnTest.h     [License: LGPL (v2+)]
M  +2    -2    src/KDbNativeStatementBuilder.cpp
M  +87   -28   src/KDbOrderByColumn.cpp
M  +40   -13   src/KDbOrderByColumn.h
M  +17   -28   src/KDbQueryColumnInfo.cpp
M  +25   -1    src/KDbQueryColumnInfo.h
M  +18   -4    src/KDbQuerySchema.cpp
M  +29   -1    src/KDbQuerySchema_p.h

https://commits.kde.org/kdb/3414fbddffa433b23d43376b44fef5421b734250
Comment 4 Jarosław Staniek 2018-05-16 08:23:39 UTC
Git commit 90c3ed3251ddcebee4ac4d2dce1c24c857967bd3 by Jaroslaw Staniek.
Committed on 16/05/2018 at 08:23.
Pushed by staniek into branch '3.1'.

Fix crash in data fetching and aggregation scripts in reports

Summary:
FIXED-IN:3.1.1

NOTE: Reports can still crash in Design view until 393705 (ORDER BY) is fixed (3.2).

Test Plan:
Test 1. Open report from https://bugs.kde.org/show_bug.cgi?id=392753#c0

Test 2. Create report field with data sources like these and try it:

```
=field.max("....")
=field.min("....")
=field.sum("....")
=field.avg("....")
=field.count("....")
```

Reviewers: piggz

Reviewed By: piggz

Subscribers: Kexi-Devel-list

Tags: #kexi

Differential Revision: https://phabricator.kde.org/D12868

M  +53   -3    src/plugins/reports/KexiDBReportDataSource.cpp
M  +16   -1    src/plugins/reports/KexiDBReportDataSource.h
M  +5    -5    src/plugins/reports/kexireportview.cpp
M  +3    -4    src/plugins/reports/kexireportview.h
M  +7    -56   src/plugins/reports/krscriptfunctions.cpp
M  +8    -6    src/plugins/reports/krscriptfunctions.h

https://commits.kde.org/kexi/90c3ed3251ddcebee4ac4d2dce1c24c857967bd3
Comment 5 Jarosław Staniek 2018-05-16 12:59:56 UTC
Feel free to test the git version.
Comment 6 Jarosław Staniek 2019-01-06 21:47:09 UTC
Git commit d1b31bd8a6fc6632f8eeab70b5e9a0f1c8630c8f by Jaroslaw Staniek.
Committed on 06/01/2019 at 21:16.
Pushed by staniek into branch '3.2'.

Fix handling ORDER BY part of queries

Summary:
- new APIs
- maintain relations between connections, queries and column infos
- fix cloning queries with ORDER BY
- update and add autotests

FIXED-IN:3.2
Related: bug 393705

Test Plan:
Required: KEXI & KDb 3.2 (current master)

Test 1: Open report and query from https://bugs.kde.org/show_bug.cgi?id=392753#c0 in design and data views.
Expected: works, no crashes

Test 2: Try these on a standard Persons and Cars test:
select id from cars order by owner;
select id from cars order by owner, model, id;
select id, model from cars order by 2, 1;

Expected: works, no crash

Reviewers: piggz

Reviewed By: piggz

Subscribers: Kexi-Devel-list

Tags: #kdb

Differential Revision: https://phabricator.kde.org/D12873

M  +3    -0    autotests/CMakeLists.txt
A  +212  -0    autotests/OrderByColumnTest.cpp     [License: LGPL (v2+)]
A  +46   -0    autotests/OrderByColumnTest.h     [License: LGPL (v2+)]
M  +2    -2    src/KDbNativeStatementBuilder.cpp
M  +87   -28   src/KDbOrderByColumn.cpp
M  +40   -13   src/KDbOrderByColumn.h
M  +17   -28   src/KDbQueryColumnInfo.cpp
M  +25   -1    src/KDbQueryColumnInfo.h
M  +18   -4    src/KDbQuerySchema.cpp
M  +29   -1    src/KDbQuerySchema_p.h

https://commits.kde.org/kdb/d1b31bd8a6fc6632f8eeab70b5e9a0f1c8630c8f