[Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Post by wmayer »

wmayer wrote: Mon May 09, 2022 1:44 pm So, it must be checked whether all this happens inside SheetTableView::commitData
The implementation of SheetTableView::commitData is

Code: Select all

void SheetTableView::commitData(QWidget* editor)
{
    QTableView::commitData(editor);
}
and I added a printf() statement before and after QTableView::commitData. Running another test showed that indeed the call of QTableView::commitData triggers the whole time-expensive recompute of the document. I think we should delay the recompute until after QTableView::commitData has been executed.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Post by wmayer »

This is the function that will be triggered when editing a cell. The calling instances are SpreadsheetDelegate::setModelData and QAbstractItemView::commitData.

I think the whole EditRole block should be moved to a separate function that will be delayed until QAbstractItemView::commitData has finished. Additionally there should be an option to disable the call of

Code: Select all

Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
because then a user doesn't have to wait several minutes after each change of a cell. However, the Recompute button must be pressed manually then.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Post by wmayer »

Frank Schrüfer wrote: Mon May 09, 2022 2:11 am The bugreport at qt is: https://bugreports.qt.io/browse/QTBUG-103333
Have you seen the reply to your bug report?
Looks like FreeCAD has a threading problem. I need a smaller testcase than the full application.
I have written a small test application where I simulate a long pending process to update a cell in SheetModel::setData(). When following the procedure I described in the file dialog.cpp it crashes very reliably but may take a while until it does. Sometimes it also prints the warning:
QObject::installEventFilter(): Cannot filter events for objects in a different thread.
which means that it's definitely not a threading problem in FreeCAD.


Can you forward the ZIP file to the bug report, please? And when you are there could you also ask whether it's a good idea to put the time consuming operation into SheetModel::setData() or if it's better to start a single-shot timer and perform the operation afterwards?

Thanks in advance!
Attachments
QtCrash.zip
(3.93 KiB) Downloaded 18 times
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: [Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Post by openBrain »

wmayer wrote: Wed May 11, 2022 12:35 pm if it's better to start a single-shot timer and perform the operation afterwards?
I find this horrible. :D You should instead use 'QMetaObject::invokeMethod' with a 'Qt::QueuedConnection' type. :)
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Post by wmayer »

@Frank Schrüfer ping
Frank Schrüfer
Posts: 34
Joined: Sat Dec 25, 2021 12:23 pm

Re: [Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Post by Frank Schrüfer »

wmayer wrote: Wed May 11, 2022 12:35 pm Can you forward the ZIP file to the bug report, please? And when you are there could you also ask whether it's a good idea to put the time consuming operation into SheetModel::setData() or if it's better to start a single-shot timer and perform the operation afterwards?
Thanks, I did as you requested.

My response-times are really bad lately, sorry for that :-)
Ever noticed that things that need your attention tend to have the habit to come in bulk? ;-)
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [Bug] SIGBUS & SIGSEGV altering spreadsheet parameter

Post by wmayer »

Thanks, I did as you requested.
Thanks. So after all it's obviously a bug in Qt.
Post Reply