instability issues for "heaps"

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
oddtopus
Posts: 142
Joined: Tue Sep 20, 2016 6:17 pm

instability issues for "heaps"

Post by oddtopus »

Hello.
I started a workbench for FreeCAD in github.com/oddtopus/heaps. It should be an aid to merge files into the active document of FC.
Actually I'm stuck with a problem. I noticed a different behaviour running it on a Windows system (i.e. FC0.16.6700 on Vista SP1) and on GNU/Linux:

OS: Linux Mint 18 Sarah
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.6707 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: 5465bc47c95db45e0be85dc0e2872419efadce0f
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Mint/Mate 18

Unexpectedly I'm experiencing more instability on GNU/Linux: for example, it shuts down FC while doing operations such as "Add things" in the heap-manager or anyway when I try to open some QtFileDialog. These bugs come out erratically and if I re-open FC and do the same operations, it happens that it doesn't fail again in the same way.
Could it be something related to the Qt libraries?
Is there something I forgot when calling the QFileDialog? (for example the parent declaration)
Or some "ghost" of the instance heapsForm that I create to open the dialogs?

Another example:
- I create an empty "heap" file, i.e. just an .xml with the following text: <heap type="newStuff"> </heap>
- Open it from the "Heaps manager" dialog.
- Create one "stuff" category, for example named "stuff1": [Add stuff] button.
- Add "things" to it: select "stuff1" in the list (don't care about the error message at this stage, that is known and will be patched in next commit) and push [Add things], then browse to some .fcstd files.
At this time all seems OK, because in the .xml file new tags are created with the information relevant to the new "things" added to the stuff category "stuff1".
but when I use the "Merge things" command, then open the heap just modified, then select the stuff in the list on the left, select the thing in the list on the right and finally push on [Merge thing], this is what I got:

STL exception thrown (basic_ios::clear: iostream error)Traceback (most recent call last):
File "[..]/Mod/heapsOstuff/heaps.py", line 286, in insertThing
importAndMove(file2merge)
File "[..]/Mod/heapsOstuff/heaps.py", line 131, in importAndMove
FreeCADGui.ActiveDocument.mergeProject(fileToMerge)
Base.FreeCADError: STL exception thrown (basic_ios::clear: iostream error)

The odd thing is that on the old-fashioned Vista system I don't have any of these problems! It add things and merges it smoothly.

I am not an expert in PySide/Qt but I'd like to make it work on GNU/Linux too. Can anybody advise how I can improve this code and explain the difference between the behaviour in these two OS?

ADDITIONAL INFO: below is the output of log file before FreeCAD was shut-down while I was merging a file using "heaps".
Log: Active view is Senza nome : 1[*] (at 0xab3a628)
Log: X Error: BadWindow (invalid Window parameter) 3
Major opcode: 31 (X_GrabKeyboard)
Resource id: 0x0
Log: Active view is Senza nome : 1[*] (at 0xab3a628)
Err: *** Abort *** an exception was raised, but no catch was found.Err:
Err: ... The exception is:Err: SIGSEGV 'segmentation violation' detected. Address 8Err:
Those "X Error" came out time by time during the log file and that makes me think of a PySide problem. Anyway they didn't crash the program immediately. Maybe the OS is able to handle those errors until a more serious one closes the application.

Any hint to solve this bug is very welcome.

Thanks
Post Reply