Bug 371896 - Kexi crashed when saving after renaming a field
Summary: Kexi crashed when saving after renaming a field
Status: CLOSED FIXED
Alias: None
Product: KEXI
Classification: Applications
Component: Tables (show other bugs)
Version: 2.9.7
Platform: Ubuntu Linux
: NOR crash
Target Milestone: 3.1
Assignee: Jarosław Staniek
URL:
Keywords:
Depends on: 371958
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-31 15:54 UTC by Begonia
Modified: 2018-01-07 01:11 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.1.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Begonia 2016-10-31 15:54:22 UTC
Application: kexi (2.9.7)
KDE Platform Version: 4.14.16
Qt Version: 4.8.7
Operating System: Linux 4.4.0-45-generic x86_64
Distribution: Ubuntu 16.04.1 LTS

-- Information about the crash:
<I had just modified the name of a field in existing table, and had linked it as a foreign key to a primary key in another table. When I selected save, it crashed.>

-- Backtrace:
Application: Kexi (kexi), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fb4ddafb940 (LWP 4597))]

Thread 3 (Thread 0x7fb4b8a93700 (LWP 4603)):
#0  0x00007fb4dba3db5d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007fb4d78a839c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fb4d78a8722 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fb4ca23f916 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4  0x00007fb4d78cebc5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007fb4d81d770a in start_thread (arg=0x7fb4b8a93700) at pthread_create.c:333
#6  0x00007fb4dba4982d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7fb4b9294700 (LWP 4602)):
#0  0x00007fb4dba3db5d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007fb4d78a839c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fb4d78a84ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fb4d78a84e9 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007fb4d78cebc5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007fb4d81d770a in start_thread (arg=0x7fb4b9294700) at pthread_create.c:333
#6  0x00007fb4dba4982d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7fb4ddafb940 (LWP 4597)):
[KCrash Handler]
#6  0x00007fb4da8ccbe4 in KexiDB::TableViewColumn::isReadOnly() const () from /usr/lib/libcalligradb.so.14
#7  0x00007fb4b9a10a7c in ?? () from /usr/lib/libkexidatatable.so.14
#8  0x00007fb4dbe96a76 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007fb4dc3c3fbc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007fb4dc3caf16 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11 0x00007fb4d9f086aa in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#12 0x00007fb4dbe9690d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#13 0x00007fb4dc3c646d in QApplicationPrivate::enterModal(QWidget*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007fb4dc417d81 in QWidgetPrivate::show_helper() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007fb4dc419c0a in QWidget::setVisible(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007fb4dc8a758e in QDialog::setVisible(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007fb4dc8a69f6 in QDialog::exec() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007fb4d9e6f322 in KMessageBox::createKMessageBox(KDialog*, QIcon const&, QString const&, QStringList const&, QString const&, bool*, QFlags<KMessageBox::Option>, QString const&, QMessageBox::Icon) () from /usr/lib/libkdeui.so.5
#19 0x00007fb4d9e6f632 in KMessageBox::createKMessageBox(KDialog*, QMessageBox::Icon, QString const&, QStringList const&, QString const&, bool*, QFlags<KMessageBox::Option>, QString const&) () from /usr/lib/libkdeui.so.5
#20 0x00007fb4d9e70b78 in KMessageBox::questionYesNoListWId(unsigned long, QString const&, QStringList const&, QString const&, KGuiItem const&, KGuiItem const&, QString const&, QFlags<KMessageBox::Option>) () from /usr/lib/libkdeui.so.5
#21 0x00007fb4d9e70e6a in KMessageBox::questionYesNoList(QWidget*, QString const&, QStringList const&, QString const&, KGuiItem const&, KGuiItem const&, QString const&, QFlags<KMessageBox::Option>) () from /usr/lib/libkdeui.so.5
#22 0x00007fb4d9e70ee1 in KMessageBox::questionYesNo(QWidget*, QString const&, QString const&, KGuiItem const&, KGuiItem const&, QString const&, QFlags<KMessageBox::Option>) () from /usr/lib/libkdeui.so.5
#23 0x00007fb4b9c51949 in ?? () from /usr/lib/kde4/kexihandler_table.so
#24 0x00007fb4dd419931 in KexiWindow::storeData(bool) () from /usr/lib/libkexicore.so.14
#25 0x00007fb4dd6c03f9 in KexiMainWindow::saveObject(KexiWindow*, QString const&, QFlags<KexiMainWindowIface::SaveObjectOption>) () from /usr/lib/libkeximain.so.14
#26 0x00007fb4dd6bb91f in KexiMainWindow::slotProjectSave() () from /usr/lib/libkeximain.so.14
#27 0x00007fb4dd6cf775 in ?? () from /usr/lib/libkeximain.so.14
#28 0x00007fb4dbeab010 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#29 0x00007fb4dc3bdd62 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#30 0x00007fb4dc3bf0b3 in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#31 0x00007fb4dbeab010 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#32 0x00007fb4dca68d12 in QAbstractButton::clicked(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#33 0x00007fb4dc79e2b3 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#34 0x00007fb4dc79f664 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#35 0x00007fb4dc79f774 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#36 0x00007fb4dc86573a in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#37 0x00007fb4dc41a8d0 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#38 0x00007fb4dc3c3fdc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#39 0x00007fb4dc3cb0d6 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#40 0x00007fb4d9f086aa in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#41 0x00007fb4dbe9690d in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#42 0x00007fb4dc3ca6dd in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#43 0x00007fb4dc4483f2 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#44 0x00007fb4dc447c83 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#45 0x00007fb4dc471542 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#46 0x00007fb4d78a81a7 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#47 0x00007fb4d78a8400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#48 0x00007fb4d78a84ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 0x00007fb4dbec72ce in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#50 0x00007fb4dc471616 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#51 0x00007fb4dbe9518f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#52 0x00007fb4dbe954f5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#53 0x00007fb4dbe9b4b9 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#54 0x0000000000400939 in ?? ()
#55 0x00007fb4db963830 in __libc_start_main (main=0x4008f0, argc=2, argv=0x7ffe9d819608, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe9d8195f8) at ../csu/libc-start.c:291
#56 0x00000000004009a9 in _start ()
Comment 1 Jarosław Staniek 2016-10-31 22:27:01 UTC
Confirmed, good find, Begonia!

Still exists even in 3.x.

Current workaround is to save after field rename, then add the reference.
Comment 2 Jarosław Staniek 2016-10-31 22:28:05 UTC
Since workaround exists, setting Severity to Crash.
Comment 3 Jarosław Staniek 2018-01-07 01:08:50 UTC
Git commit 3d6032f4f5e503f2cfdf05eeb48cf4ddcbd80aa2 by Jaroslaw Staniek.
Committed on 07/01/2018 at 01:07.
Pushed by staniek into branch 'master'.

Expand scope of KDbTableSchemaChangeListener to allow registering queries for changes in table schema

Summary:
Listener related to a query can receive "close" request if table design the query depends on is about to be changed.
This way for example Kexi is able to ask users to close form or report if it uses query depending on altered table.
FIXED-IN:3.1.0

When table schema is removed unregister it from KDbTableSchemaChangeListener objects

FIXED-IN:3.1.0

Test Plan: Test Kexi for https://phabricator.kde.org/D8118

Reviewers: piggz

Reviewed By: piggz

Tags: #kdb

Maniphest Tasks: T7703, T7704

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

M  +1    -0    src/CMakeLists.txt
M  +1    -0    src/KDbConnection.cpp
M  +2    -1    src/KDbConnection.h
M  +2    -0    src/KDbConnection_p.h
M  +489  -30   src/KDbTableSchemaChangeListener.cpp
M  +78   -14   src/KDbTableSchemaChangeListener.h
M  +5    -0    src/config-kdb.h.cmake

https://commits.kde.org/kdb/3d6032f4f5e503f2cfdf05eeb48cf4ddcbd80aa2
Comment 4 Jarosław Staniek 2018-01-07 01:09:52 UTC
Git commit 1400c0fbcb4436db1bc2ad5f7d5784b676c932c9 by Jaroslaw Staniek.
Committed on 07/01/2018 at 01:09.
Pushed by staniek into branch 'master'.

Before physical altering or deleting table ask the user to close depending table/query/report/form

Summary:
If table T is altered, before saving:
- close all table views that use T in lookup fields
- close all query views that use T
- close all query views that use tables having T in lookup fields
- close all tables that use queries in lookup fields and the queries use T

Similarly, close all forms/reports that use tables this way.
Any views are affected (data, design, text).

Also:
- improve existing question messages
- remove Report's extended data source GUI
FIXED-IN:3.1.0

Test Plan:
Use the test Kexi file (uncompress before testing):
{F4442302}

Test 1.1: If table T is altered, before saving close all table views that use T in lookup fields.

1. Open ownership table in data view.
2. Design the persons table, rename the last (Extra) field to something else, save design.
3. Expected: Kexi asks to close the ownership table. On agreement, they are closed and the design is saved.

Test 1.2. Like 1.1 but open ownership table in design view.
Expected result: like in 1.1.

Test 2.1. If table T is altered, before saving close all query views that use T.

1. Open persons_and_cars query in data view.
2. Design the persons table, rename the last field to something else, save design.
3. Expected: Kexi asks to close the persons_and_cars query. On agreement, they are closed and the design is saved.

Test 2.2. Like 2.1 but open the query in design view.
Expected result: like in 2.1.

Test 2.3. Like 2.1 but open the query in SQL view.
Expected result: like in 2.1.

Test 2.4. Like 2.1 but also open the **ownership table** after 2nd step.
Expected result: Kexi asks to close both the ownership table and the persons_and_cars query. On agreement, they are closed and the design is saved.

Test 2.5. Like 2.4 but also open the **persons form** before saving.
Expected result: Kexi asks to close both the ownership table and the persons_and_cars query and the persons form. On agreement, they are closed and the design is saved.

Test 2.6. Like 2.5 but also open the **persons report** before saving.
Expected result: Kexi asks to close both the ownership table and the persons_and_cars query and the persons form and the persons report. On agreement, they are closed and the design is saved.

Test 3.1. If table T is altered, before saving close all query views that use tables having T in lookup fields.

1. Open ownership_desc query in data view.
2. Design the persons table, rename the last field to something else, save design.
3. Expected: Kexi asks to close the ownership_desc query. On agreement, they are closed and the design is saved.

Test 3.2. Like 2.1 but open the table in design view.
Expected result: like in 3.1.

Test 4.1. If table T is altered, before saving close all tables that use queries in lookup fields if these queries use T.

1. Open with_lookup_query table in data view.
2. Design the persons table, rename the last field to something else, save design.
3. Expected: Kexi asks to close the with_lookup_query query. On agreement, they are closed and the design is saved.

Test 4.2. Like 4.1 but open the table in design view.
Expected result: like in 4.1.

Test 5.1. Testing if Kexi detects dependency between **report cars** and designed **table cars** because the report uses query that uses the table.

1. Open report cars in preview.
2. Design the cars table, rename and field, try to save design (finally don't save unless you have backup of the database).
3. Expected: Kexi asks to close the report cars.

Test 6.1. Improve existing question messages asking for approval for closing depending tabs: see if they sound are correct and look OK.

Example:
{F4440486}

Test 7.1. (Extra test of functionality that was hard to separate to another patch). Updated "Report data source" page (removed Set button and the External data widgets). Test if setting table and query as data source works.

Reviewers: piggz

Reviewed By: piggz

Tags: #kexi

Maniphest Tasks: T7703, T7704

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

M  +10   -1    src/plugins/forms/kexidatasourcepage.cpp
M  +7    -1    src/plugins/forms/kexidatasourcepage.h
M  +83   -4    src/plugins/forms/kexiformpart.cpp
M  +21   -3    src/plugins/forms/kexiformpart.h
M  +10   -2    src/plugins/forms/kexiformview.cpp
M  +1    -1    src/plugins/forms/kexiformview.h
M  +75   -5    src/plugins/queries/kexiquerypart.cpp
M  +33   -1    src/plugins/queries/kexiquerypart.h
M  +42   -35   src/plugins/reports/KexiDBReportDataSource.cpp
M  +5    -2    src/plugins/reports/KexiDBReportDataSource.h
M  +36   -5    src/plugins/reports/kexireportdesignview.cpp
M  +5    -2    src/plugins/reports/kexireportdesignview.h
M  +38   -3    src/plugins/reports/kexireportpart.cpp
M  +19   -3    src/plugins/reports/kexireportpart.h
M  +2    -18   src/plugins/reports/kexireportview.cpp
M  +10   -25   src/plugins/reports/kexisourceselector.cpp
M  +15   -1    src/plugins/reports/kexisourceselector.h
M  +13   -8    src/plugins/tables/kexitabledesignerview.cpp
M  +1    -1    src/plugins/tables/kexitabledesignerview.h
M  +51   -26   src/plugins/tables/kexitablepart.cpp
M  +34   -15   src/plugins/tables/kexitablepart.h
M  +1    -1    src/widget/dataviewcommon/kexiformdataiteminterface.h

https://commits.kde.org/kexi/1400c0fbcb4436db1bc2ad5f7d5784b676c932c9