Comments (5)
when calling the "Involute Gear" command from PartDesign
Does this only happen with this command or with others too that load a task dialog (e.g. Pad, Pocket, ...)?
from freecad.
I wonder whether the two toEnum() functions really have to be that complicated and that we can't simply write:
qsizetype PythonWrapper::toEnum(PyObject* pyPtr)
{
try {
Py::Long longObj(PyNumber_Long(pyPtr), true);
return longObj.as_long();
}
catch (Py::Exception&) {
Base::PyException e;
e.ReportException();
return 0;
}
}
qsizetype PythonWrapper::toEnum(const Py::Object& pyobject)
{
return toEnum(pyobject.ptr());
}
This will have the same effect like the casts to an int on Python side:
return int(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
In #13611 it was claimed that this cast caused various problems but when looking at the mentioned issues all of them had other reasons and thus I doubt that Shiboken::Enum::getValue
is needed at all.
from freecad.
I haven't figured out who really caused this. It could be libshiboken
For some reason the passed value to Shiboken::Enum::getValue
is not of the expected type in your case and that's why check() causes the assert to fail:
long Shiboken::Enum::getValue(PyObject *enumItem)
{
assert(Shiboken::Enum::check(enumItem));
...
}
from freecad.
when calling the "Involute Gear" command from PartDesign
Does this only happen with this command or with others too that load a task dialog (e.g. Pad, Pocket, ...)?
From the code I think this will happen with any dialog that is created in python, but I haven't checked.
Using PyNumber_Long
will fixed it. There are multiple helper functions to convert from python to c++. I a sense, using toEnum
in getStandardButtons
is just wrong because it returns a QFlags
not an enum so it should call a toFlags
function. On the other hand toEnum
returns an int
not an enum which should probably a template function with a static_cast<T>()
in it.
I haven't figured out who really caused this. It could be libshiboken
For some reason the passed value to
Shiboken::Enum::getValue
is not of the expected type in your case and that's why check() causes the assert to fail:
That was clear, but it worked before and I supect some weired interactions with package updates. But It could also be just the PR that changed the int
casts.
I can test with your simplified function, I'm sure that will work.
from freecad.
@wwmayer I tested the simplified functions you posted and the crash is gone.
from freecad.
Related Issues (20)
- Invalid "Download" link on web site HOT 1
- Opening file with Draft Array (Link) has major performance degradation HOT 2
- Loading a project file can be extremely slow HOT 1
- Windows: Stylesheet/Theme can not be applied after changing default system config directories HOT 6
- Recent change to SetupCoin3D.cmake breaks snap package build HOT 1
- TTF fonts with ligatures are not rendered correctly in Draft Shape From Text HOT 1
- Crash on closing FreeCAD with python debugging on HOT 6
- Problems with the new Insert View Button with large 3D files HOT 2
- Unable to import FreeCAD in python script HOT 2
- Sketcher: new BSpline tool: crash when selecting "By knots" HOT 3
- Better visibility of 3D models in Sketcher HOT 15
- Sketcher: Dimension tool sometimes unnecessarily enters construction mode HOT 3
- Highlight of selected faces poorly visible when camera is aligned HOT 11
- Gui: System icons on Linux can be not-readable with themes
- Sketcher Rotate use for 360-degree patterns is unintuitive HOT 1
- Draft shape 2d view generates extra lines HOT 2
- Tree View problems HOT 3
- sketch add text HOT 2
- Attachment position of ShapeString not relative to edge bounding box. HOT 3
- ShapeString .Shape.BoundBox.XLength is zero for ShapeStrings positioned along YZ plane HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from freecad.