enthought / enthought/comtypes
Crash caused by incorrectly generated code for VARIANT function input
- Dominant language
- Python
- Stars
- 345
- Forks
- 105
- PR merge metrics
- No merged PRs in 30d
Description
While working with AutoCAD objects ran into app crash. It was reported sometimes as `stack overflow` or `access violation`.
Investigation showed that there was a method signature generated as:
```
IAcadBlock._methods_ = [
COMMETHOD([dispid(0), helpstring(u'Gets the member object at a given index in a collection, group, or selection set')], HRESULT, 'Item',
( ['in'], VARIANT, 'Index' ),
( ['retval', 'out'], POINTER(POINTER(IAcadEntity)), 'pItem' )),
```
Manual tweaking and change to (Note `POINTER(VARIANT)` vs `VARIANT` as an input):
```
IAcadBlock._methods_ = [
COMMETHOD([dispid(0), helpstring(u'Gets the member object at a given index in a collection, group, or selection set')], HRESULT, 'Item',
( ['in'], POINTER(VARIANT), 'Index' ),
( ['retval', 'out'], POINTER(POINTER(IAcadEntity)), 'pItem' )),
```
made it run as expected.
Not sure yet where this has to be fixed to make it permanent in the code generation logic.
I can provide `tlb` file used to produce generated code. Please let me know.
Contributor guide
Assessment
This issue has not been assessed yet.