===================================================
The bug was introduced by myself here:
47c0859c1b
[code]
void SketchObject::onDocumentRestored()
{
try {
- rebuildExternalGeometry();
+ if(Support.getValue()) {
+ validateExternalLinks();
+ rebuildExternalGeometry();
+ }
Constraints.acceptGeometry(getCompleteGeometry());
}
[/code]
The issue is that "rebuildExternalGeometry" calls "rebuildVertexIndex". So for any sketch not having external geometry, if you open it, select everything and hit del, you will have a crash because
I effectively removed the creation of the index in this dossier. You won't have one if you do anything rebuilding the index before hitting del, like creating geometry, though.
================================================
Issue reported inter alia here:
http://forum.freecadweb.org/viewtopic.php?f=10&t=12380#p99456
How to reproduce:
1. Make an external geometry hexagon (make a hexagon, pad it, make a sketch on a hexagonal face and make all the lines external geometry)
2. Box select the external lines and press "del"
On the first pressing of "del" 3 lines were deleted and 3 remained, select again, on the second press 1 remains, select again, on the last press all are deleted.
Why?
Internal and External geometry were handled together in a single set. Group deletion of geometry is effected starting from the highest index,
so that upon deleting an element, the index of the remaining elements does not change. Handling both groups together caused that the external geometry
was actually deleted on the inversed order (as they are (decreasing) negative values for representation, but increasing positive indexes in the external geometry array).
Solution:
Internal and External geometries are handled separatedly
+ set application-wide event filter and handle mouse press events
+ fix expressPosition() to return exact position of line edit
+ fix warnings in ui file
+ use DlgExpressionInput as non-modal dialog in QuantitySpinBox
BOM is byte order mark and it was crashing ConfigParser:
Traceback (most recent call last):
File
"/home/przemo/software/FreeCAD/build/Mod/Fem/MechanicalMaterial.py",
line 109, in setEdit
taskd = _MechanicalMaterialTaskPanel(self.Object)
File
"/home/przemo/software/FreeCAD/build/Mod/Fem/MechanicalMaterial.py",
line 138, in __init__
self.import_materials()
File
"/home/przemo/software/FreeCAD/build/Mod/Fem/MechanicalMaterial.py",
line 264, in import_materials
self.add_mat_dir(user_mat_dirname,
":/icons/preferences-general.svg")
File
"/home/przemo/software/FreeCAD/build/Mod/Fem/MechanicalMaterial.py",
line 245, in add_mat_dir
self.materials[a_path] = Material.importFCMat(a_path)
File "/home/przemo/software/FreeCAD/build/Mod/Material/Material.py",
line 57, in importFCMat
Config.read(fileName)
File "/usr/lib64/python2.7/ConfigParser.py", line 305, in read
self._read(fp, filename)
File "/usr/lib64/python2.7/ConfigParser.py", line 512, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
<class 'ConfigParser.MissingSectionHeaderError'>: File contains no
section headers.
file: /home/przemo/.FreeCAD/Materials/AlMg3F24.FCMat, line: 1
'\xef\xbb\xbf; AlMg3F24 - 3.3535.26 - DIN 1725\n'
Reported-by: sgrogan
Signed-off-by: Przemo Firszt <przemo@firszt.eu>