[Bug Confirmed] Deleting Rows in Spreadsheet WB sometimes crashes and causes unexpected results below deleted rows

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
PAS_Drafter
Posts: 338
Joined: Mon Aug 02, 2021 6:29 am
Location: California, USA

[Bug Confirmed] Deleting Rows in Spreadsheet WB sometimes crashes and causes unexpected results below deleted rows

Post by PAS_Drafter »

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.1.29410 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: f5d13554ecc7a456fb6e970568ae5c74ba727563
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods: 
  * Assembly4 0.12.3
  * Curves 0.5.6
  * ExplodedAssembly
  * fasteners 0.4.2
  * Manipulator 1.4.9
  * MOOC 2022.4.21
  * OpticsWorkbench 1.0.8
  * sheetmetal 0.2.56
  * ToolViewReverse_ToolBar
Ever since v.20 came out (and carrying on to v20.1) I have had a lot of problems with the Spreadsheet WB. I've documented a couple already, but today I've been battling some others that I have not been able to reliably duplicate. I have noticed that most of the problems occur when I start removing or inserting rows in the spreadsheet. It might happen when working with columns as well, but I do not often do that so I don't know for sure.

I often reuse spreadsheets from one file to the next as I have a template I like to use. While I am building my new part, I often end up Inserting and Removing rows in the new file to match what I need for that particular part. Many times it will work as expected and I have no problems. Then at other times, I have nothing but problems. Cells that use to be in the same row below where I've removed things are no longer in the same row, I often get a #PENDING message in cells below the remove point, and occasionally it will crash FreeCAD completely. Using UNDO to get me back to where I was before does not work either as it seems to mess things up even more. It gets to the point where I have to remove a single row, save the file, close it, open it back up, remove another row, and then repeat until I get all the rows removed I want. This is not very conducive to getting work done. :cry:

I finally got a file that I can duplicate some of the errors so I'm finally able to post something so hopefully someone can figure out what is going on.

If you open the "SSS_BermPlateLeft" spreadsheet you can see a large white area near the top between rows 6 and 16 that I want to remove. Before removing anything, scroll down to rows 69-76 and notice the rows are properly aligned as shown here:

BeforeDelete.PNG
BeforeDelete.PNG (48.17 KiB) Viewed 559 times

Now go back up and just Remove Row 6. If you scroll back down to row 69, you will see that some of the alignment is no longer correct as shown here.

AfterDelete1.PNG
AfterDelete1.PNG (49.08 KiB) Viewed 559 times


Go back up and Remove Row 6 again. Now the screen fills up with a bunch of #PENDING messages and if you go back down to row 67, you will notice that the rows are really messed up now.

AfterDelete2.PNG
AfterDelete2.PNG (43.09 KiB) Viewed 559 times

Now if you go back up and Remove row 6 one more time, FreeCAD Crashes all together. While crashing, I notice an Illegal Storage Access error message.

I've been able to duplicate these steps multiple times, so I'm hoping others can duplicate this also.

Now the funny thing is if I delete Row 6, then close the file and save it, when I open it back up, the row was deleted and the data below which was screwed up comes back normal.

SaveafterDelete.PNG
SaveafterDelete.PNG (18.69 KiB) Viewed 559 times

So if I go and delete one row at a time, close the file and save each time, I eventually get everything deleted. Very frustrating. I suspect the problem has to do with when cells are merged together as that seems to be the point where things go to heck at first.

Let me know if you need more info. Hopefully someone can figure this out as it is driving me nuts.

Thanks
Attachments
SpreadsheetIssue.FCStd
(29.07 KiB) Downloaded 13 times
Last edited by PAS_Drafter on Fri Oct 07, 2022 3:16 pm, edited 1 time in total.
User avatar
Roy_043
Veteran
Posts: 8452
Joined: Thu Dec 27, 2018 12:28 pm

Re: Deleting Rows in Spreadsheet WB sometimes crashes and causes unexpected results below deleted rows

Post by Roy_043 »

Confirmed.

I have added a link to this topic in this issue:
https://github.com/FreeCAD/FreeCAD/issues/7511

Code: Select all

OS: Windows 8.1 Version 6.3 (Build 9600)
Word size of FreeCAD: 64-bit
Version: 0.21.30492 (Git)
Build type: Release
Branch: master
Hash: b4578fb3eae842eb510a1bc055d07d369a67ce94
Python 3.10.6, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: C/Default (C) [ OS: Dutch/Netherlands (nl_NL) ]
Installed mods: 
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Deleting Rows in Spreadsheet WB sometimes crashes and causes unexpected results below deleted rows

Post by openBrain »

I can confirm. There is a flaw in FreeCAD Spreadsheet code in the part that deals with merged cells when deleting a row.
This is what creates the mess, then the crash (at the end a null pointer is dereferenced).

Will probably take some time to fix.
PAS_Drafter
Posts: 338
Joined: Mon Aug 02, 2021 6:29 am
Location: California, USA

Re: Deleting Rows in Spreadsheet WB sometimes crashes and causes unexpected results below deleted rows

Post by PAS_Drafter »

Roy_043 wrote: Fri Oct 07, 2022 8:24 am Confirmed.
openBrain wrote: Fri Oct 07, 2022 11:36 am I can confirm.
Thanks for confirming.

I hope I did this right as this is the first time I've added a bug. I created a ticket in github so it can be tracked linking back to this discussion. Let me know if I need to do anything differently.

https://github.com/FreeCAD/FreeCAD/issues/7575
Post Reply