View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002202 | FreeCAD | Bug | public | 2015-07-30 09:36 | 2016-02-29 09:39 |
Reporter | hamish2014 | Assigned To | wmayer | ||
Priority | normal | Severity | crash | Reproducibility | sometimes |
Status | closed | Resolution | fixed | ||
Platform | 64 bit | OS | ubuntu | OS Version | 14.04.1 |
Fixed in Version | 0.16 | ||||
Summary | 0002202: Crash when selecting an item in Model Tree | ||||
Description | Error freecad: /build/freecad-DbhPXM/freecad-0.16+bzr3899+201507292053~ubuntu14.04.1/src/App/Enumeration.cpp:260: std::vector<std::basic_string<char> > App::Enumeration::getEnumVector() const: Assertion `_EnumArray' failed. | ||||
Steps To Reproduce | see attached video | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
|
|
Can you try to isolate somehow in your python code where this happens? It is hard to know what happens just by looking at the video... |
|
Hi Yorik, To my knowledge the crash does not happen in my Python Code. The crash happens when I select (left-click on) a constraint object (App::PythonFeature) in Gui tree. Maybe the Assembly2 workbenchs code for the context menu code, (i.e. for generating the pop-up menu) def ContextMenu(self, recipient): selection = [s for s in FreeCADGui.Selection.getSelection() if s.Document == FreeCAD.ActiveDocument ] if len(selection) == 1: obj = selection[0] if hasattr(obj,'Content'): if 'ConstraintInfo' in obj.Content: redefineCmd = { 'plane':'redefinePlaneConstraint', 'angle_between_planes':'redefineAngleConstraint', 'axial': 'redefineAxialConstraint', 'circularEdge' : 'redefineCircularEdgeConstraint', 'sphericalSurface' : 'redefineSphericalSurfaceConstraint' }[ obj.Type ] self.appendContextMenu( "Assembly2", [redefineCmd,'selectConstraintObjects']) if 'sourceFile' in obj.Content: self.appendContextMenu( "Assembly2", ['assembly2_movePart', 'assembly2_duplicatePart', 'assembly2_editImportedPart', 'assembly2_forkImportedPart', 'assembly2_deletePartsConstraints']) But this should only happen when a user right-clicks, not left-clicks. Another reason I suspect that this error is not related to the assembly 2 workbench is that the crash occur depending on the FreeCAD daily build via the Ubuntu PPA. i.e. when i reported this bug, my FreeCAD build was crashing all the time when select an item in the gui tree. Now with a more recent daily build the crashes have stopped (while the assembly2 code has remained exactly the same). Stopped at least for the moment. These crashes do not only happened to me see https://github.com/hamish2014/FreeCAD_assembly2/issues/28 I was hoping the crash output would help: freecad: /build/freecad-DbhPXM/freecad-0.16+bzr3899+201507292053~ubuntu14.04.1/src/App/Enumeration.cpp:260: std::vector<std::basic_string<char> > App::Enumeration::getEnumVector() const: Assertion `_EnumArray' failed. Anyway, I suppose since the crashes have stopped at the moment, you may close the issue. |
|
Yes, the problem is certainly in the FreeCAD core code, not in your module, but it doesn't happen with other python features (Draft objects for example), only yours. So there must be something specific in your code, that touches something sensitive inside FreeCAD. It would be useful to find out what that is... I would say it must happen in the view provider of that python feature... |
|
Thanks for your response Yorik, my apologies if I came across short in the previous message. Here is the code related to the Python Feature objects which when clicked upon cause the crash ''' c = FreeCAD.ActiveDocument.addObject("App::FeaturePython", cName) c.addProperty("App::PropertyString","Type","ConstraintInfo","Object 1").Type = 'axial' c.addProperty("App::PropertyString","Object1","ConstraintInfo") c.addProperty("App::PropertyString","SubElement1","ConstraintInfo") c.addProperty("App::PropertyString","Object2","ConstraintInfo") c.addProperty("App::PropertyString","SubElement2","ConstraintInfo") c.addProperty("App::PropertyEnumeration","directionConstraint", "ConstraintInfo") c.directionConstraint = ["none","aligned","opposed"] c.addProperty("App::PropertyBool","lockRotation","ConstraintInfo") c.setEditorMode('Type',1) for prop in ["Object1","Object2","SubElement1","SubElement2"]: c.setEditorMode(prop, 1) c.Proxy = ConstraintObjectProxy() ... class ConstraintObjectProxy: def execute(self, obj): self.callSolveConstraints() obj.touch() def callSolveConstraints(self): from assembly2solver import solveConstraints solveConstraints( FreeCAD.ActiveDocument ) ''' No viewprovider is specified for the "App::FeaturePython". Given the error message freecad: /build/freecad-DbhPXM/freecad-0.16+bzr3899+201507292053~ubuntu14.04.1/src/App/Enumeration.cpp:260: std::vector<std::basic_string<char> > App::Enumeration::getEnumVector() const: Assertion `_EnumArray' failed. Could the problem originate from the "App::PropertyEnumeration"? i.e. from c.addProperty("App::PropertyEnumeration","directionConstraint", "ConstraintInfo") c.directionConstraint = ["none","aligned","opposed"] Your thoughts? |
|
Hmm this is not a very common way to do it (you would normally have all the property definitions inside the class definition), but I don't think it's a problem... If you don't use a custom view provider, did you set its proxy to 0? like this: myObj.ViewObject.Proxy = 0 |
|
Thanks, i will add c.ViewObject.Proxy = 0 to my code. The crash originates from the App::PropertyEnumeration. To force the crash on my side I need to simply 1) Open FreeCAD 2) Open a new document 3) In the Python Console: >>> myFeature = FreeCAD.ActiveDocument.addObject("App::FeaturePython", "myFeature") >>> myFeature.addProperty("App::PropertyEnumeration","Enum1") 4) click on myFeature in the GuiTree. which cause FreeCAD to crash with the following error (the one reported in the bug description) freecad: /build/freecad-gdB0BM/freecad-0.16+bzr3903+201507302201~ubuntu14.04.1/src/App/Enumeration.cpp:260: std::vector<std::basic_string<char> > App::Enumeration::getEnumVector() const: Assertion `_EnumArray' failed. My version of FreeCAD is >>> FreeCAD.Version() ['0', '16', '5312 (Git)', 'git://github.com/FreeCAD/FreeCAD.git master', '2015/07/30 21:22:44', 'master', '059bbdc4967316df6c27209b153c7773cebe7819'] If choices are added (myFeature.Enum1 =['1','2','3']) no crash occurs. The confusing thing here is that when I create my PythonFeature Object, I do specify choices. c.directionConstraint = ["none","aligned","opposed"] Perhaps the problem originates, when i later remove choices for specific case: constraintValue = "aligned" if dotProduct( a,b ) > 0 else "opposed" self.constraintObj.directionConstraint = ["aligned","opposed"] self.constraintObj.directionConstraint = constraintValue Your thoughts? |
|
Hi, I can confirm this issue: http://forum.freecadweb.org/viewtopic.php?f=3&t=11706&p=94105#p94105 It is quite annoying. I have to save my work after every edit to not lose data. I think it started to crash moreless after this change: https://github.com/FreeCAD/FreeCAD/commit/f1b75dbe29c06c8f1aeffa3223304d5f71b0c50c#diff-f49d59eba616dcf16adc7c65b269b036 Cheers, Mateusz |
|
After a long and boring rendezvous with git bisect ;) here are the results: git bisect start # bad: [4f6a50ac271b74381a69f411983ba2758082573a] Fixed git link in readme git bisect bad 4f6a50ac271b74381a69f411983ba2758082573a # good: [67c4dcdf7028cba92f69d15b889d64d3271fed62] Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code git bisect good 67c4dcdf7028cba92f69d15b889d64d3271fed62 # bad: [0ea718177da0366d5358f0ce36e648cf1341a80f] + set utf-8 encoding when recording a macro git bisect bad 0ea718177da0366d5358f0ce36e648cf1341a80f # good: [f20519d35202b63a011573f130a03feb7d091de1] + new parameter 'CoinOffscreenRenderer' to use Coin's offscreen renderer git bisect good f20519d35202b63a011573f130a03feb7d091de1 # good: [70318d78206f62f6593573e7b31f311a49ac9ac1] FEM: Disable Show result button if there are no results in analysis git bisect good 70318d78206f62f6593573e7b31f311a49ac9ac1 # bad: [4f5534a87a7e2d224022ff98729a341bf57e7f9e] + fixes 0002116: FreeCAD crash when I click on treeview git bisect bad 4f5534a87a7e2d224022ff98729a341bf57e7f9e # good: [895510e08d0b607a5bd060998deb26e42c502701] Draft: small bugfix in Drawing view git bisect good 895510e08d0b607a5bd060998deb26e42c502701 # good: [9766893be17116ae359f59860492b71c61afd533] FEM: Change FEM results selection to radio buttons git bisect good 9766893be17116ae359f59860492b71c61afd533 # good: [5853eabc620c470a66fea85331808f6a707bd7d3] FEM: Always import FemGui git bisect good 5853eabc620c470a66fea85331808f6a707bd7d3 # good: [3a7772d0f7fb1899b9f74a811e14255425cb6ba7] FEM: Save/restore result dialog settings git bisect good 3a7772d0f7fb1899b9f74a811e14255425cb6ba7 # good: [54317becbfa7bdffd906b03f66bb66a95717447f] + fix writing STEP settings git bisect good 54317becbfa7bdffd906b03f66bb66a95717447f # first bad commit: [4f5534a87a7e2d224022ff98729a341bf57e7f9e] + fixes 0002116: FreeCAD crash when I click on treeview HTH! Cheers, Mateusz |
|
Hi, after working with the Assembly 2 workbench for dozen or so hours I can confirm that reverting changes from 4f5534a87a7e2d224022ff98729a341bf57e7f9e does solve this issue. I have not encountered any crashes. Cheers, Mateusz |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-07-30 09:36 | hamish2014 | New Issue | |
2015-07-30 09:36 | hamish2014 | File Added: vid1.ogv | |
2015-08-05 02:26 | yorik | Note Added: 0006272 | |
2015-08-05 02:26 | yorik | Status | new => feedback |
2015-08-05 07:23 | hamish2014 | Note Added: 0006278 | |
2015-08-05 07:23 | hamish2014 | Status | feedback => new |
2015-08-05 14:21 | yorik | Note Added: 0006280 | |
2015-08-06 09:18 | hamish2014 | Note Added: 0006281 | |
2015-08-06 13:38 | yorik | Note Added: 0006282 | |
2015-08-07 09:40 | hamish2014 | Note Added: 0006283 | |
2015-08-08 14:30 | f3nix | Note Added: 0006284 | |
2015-08-08 22:32 | f3nix | Note Added: 0006286 | |
2015-08-13 16:44 | f3nix | Note Added: 0006288 | |
2016-02-29 09:38 | wmayer | Changeset attached | => FreeCAD Master master c3656ad6 |
2016-02-29 09:39 | wmayer | Status | new => closed |
2016-02-29 09:39 | wmayer | Assigned To | => wmayer |
2016-02-29 09:39 | wmayer | Resolution | open => fixed |
2016-02-29 09:39 | wmayer | Fixed in Version | => 0.16 |