View Issue Details

IDProjectCategoryView StatusLast Update
0004429FreeCADBugpublic2020-09-13 10:30
Reporterwang02139 Assigned Towmayer  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version18.04.5 LTS
Product Version0.19 
Fixed in Version0.19 
Summary0004429: Spreadsheet: Bug when inserting a row into spreadsheet
DescriptionForum thread: https://forum.freecadweb.org/viewtopic.php?f=3&t=50032

When a spreadsheet has entries with aliases which goes through 2 levels of reference, and the user inserts a row, the reference is broken and there is an error that a property is not found.

I have attached a very simple file with this problem. If you insert a row at, say, row 3, there is an error

"15:19:52 <Spreadsheet> Cell.cpp(594): Unnamed#Spreadsheet.A9: Property 'b' not found in 'b'"

There are 2 aliases:
a = 1
b = a + 1
The last cell is b+1 which has the error.

Steps To Reproduce1. Load the file
2. Open the spreadsheet
3. Insert a row at row 3
Additional InformationThis is the error message:

"15:19:52 <Spreadsheet> Cell.cpp(594): Unnamed#Spreadsheet.A9: Property 'b' not found in 'b'"
Tagsspreadsheet
FreeCAD Information
OS: Ubuntu 18.04.5 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22284 (Git) AppImage
Build type: Release
Branch: master
Hash: bf1e8e48389f5e9e25bd77b67fe98da4213e797c
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)

Activities

wang02139

2020-09-07 04:13

reporter  

wang02139

2020-09-07 06:54

reporter   ~0014729

I looked at the code and understood the problem now. Old values in revAliasProp are used before they are updated later.

Here it's using revAliasProp to look for the location, but it's the old location of the alias:
PropertySheet.cpp#L993

The alias may be changed later in moveCell which updates revAliasProp
PropertySheett.cpp#L708

Thus the dependency graph is wrong.

wang02139

2020-09-13 01:31

reporter   ~0014747

https://github.com/FreeCAD/FreeCAD/pull/3866

Move the aliases before other content of cells

When a user performs insert rows, remove rows, insert columns, or
remove rows, we need to move multiple cells as a batch. The cells are
moved sequentially. For each cell, its dependent alias positions are
looked up and dependencies are added. However, those cells with
aliases may be moved later in the batch. Thus the earlier dependencies
become wrong. This commit fixes this bug by moving all the aliases
before moving the cells. Unit tests are added to for this bug.

fixes issue 0004429

wmayer

2020-09-13 10:10

administrator   ~0014749

https://github.com/FreeCAD/FreeCAD/commit/0aa759b5c55bb9449d6eef7d38cc3ab4ef3f404f

Related Changesets

FreeCAD: master 0aa759b5

2020-09-13 00:38:03

Cheuksan Wang


Committer: wmayer Details Diff
Move the aliases before other content of cells

When a user performs insert rows, remove rows, insert columns, or
remove rows, we need to move multiple cells as a batch. The cells are
moved sequentially. For each cell, its dependent alias positions are
looked up and dependencies are added. However, those cells with
aliases may be moved later in the batch. Thus the earlier dependencies
become wrong. This commit fixes this bug by moving all the aliases
before moving the cells. Unit tests are added to for this bug.

fixes issue 0004429
Affected Issues
0004429
mod - src/Mod/Spreadsheet/App/PropertySheet.cpp Diff File
mod - src/Mod/Spreadsheet/App/PropertySheet.h Diff File
mod - src/Mod/Spreadsheet/TestSpreadsheet.py Diff File

Issue History

Date Modified Username Field Change
2020-09-07 04:13 wang02139 New Issue
2020-09-07 04:13 wang02139 Tag Attached: spreadsheet
2020-09-07 04:13 wang02139 File Added: spreadsheet_insert.FCStd
2020-09-07 06:54 wang02139 Note Added: 0014729
2020-09-13 01:31 wang02139 Note Added: 0014747
2020-09-13 10:10 wmayer Assigned To => wmayer
2020-09-13 10:10 wmayer Status new => closed
2020-09-13 10:10 wmayer Resolution open => fixed
2020-09-13 10:10 wmayer Fixed in Version => 0.19
2020-09-13 10:10 wmayer Note Added: 0014749
2020-09-13 10:30 wmayer Changeset attached => FreeCAD master 0aa759b5