View Issue Details

IDProjectCategoryView StatusLast Update
0004534FreeCADBugpublic2021-01-30 15:30
Reporterickby Assigned Toickby  
Status closedResolutionfixed 
Summary0004534: Multiple python extensions added lead to proxy problems
DescriptionAdding a python extension creates the ExtensionProxy property, which is set to the default value passed in the addExtension method. This property belongs to the extension (defined here), and is exposed as an property for the object. The problem arises when a second python extension is added to the same object. In FC the extension itself gets the ExtensionProxy setup correctly in the addExtension method, as this method directly accesses the extension to get the property (see). However, now there are two ExtensionProxy' properties in the object, one for each extension. Accessing it from python will return only one, the first one that is found (see here).

This leads to the FreeCAD bug, that you cannot change the ExtensionProxy correctly for more than one extension. Note that neither in 0.18 or 0.19 this ever occured as bug, as no one seem to use more than 1 extension and also not the ExtensionProxy and just rely on addExtension. However, it could lead to all kind of unexpected behaviour later.
Steps To Reproduceclass Proxy1():
        def init(self):

class Proxy2():
        def init(self):

p1 = Proxy1()
p2 = Proxy2()
obj = App.ActiveDocument.addObject("App::DocumentObject", "MyObject")
obj.addExtension("App::GroupExtensionPython", p1)
obj.addExtension("Part::AttachExtensionPython", p2)

print(f"ExtensionProxy is Proxy1: {isinstance(obj.ExtensionProxy, Proxy1)}")
print(f"ExtensionProxy is Proxy2: {isinstance(obj.ExtensionProxy, Proxy2)}")
TagsNo tags attached.
FreeCAD InformationOS: Manjaro Linux (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23700 (Git)
Build type: Release
Branch: master
Hash: 83cfffd1bab7161e05b36d4e7607f7f5f3cfd202
Python version: 3.9.1
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.4.0
Locale: English/Germany (en_DE)



2021-01-17 10:06

developer   ~0015210

Forum discussion:


2021-01-30 15:30

developer   ~0015228

Fix committed to master branch.

Related Changesets

FreeCAD: master 446ce215

2021-01-17 09:45:50


Committer: wwmayer Details Diff
Remove ExtensionProxy and rely on default Python proxy for extensions. fixes 0004534 Affected Issues
mod - src/App/Extension.h Diff File
mod - src/App/ExtensionContainerPy.xml Diff File
mod - src/App/ExtensionContainerPyImp.cpp Diff File
mod - src/Gui/ViewProviderExtension.h Diff File
mod - src/Mod/Arch/ Diff File
mod - src/Mod/Arch/ Diff File
mod - src/Mod/Arch/ Diff File
mod - src/Mod/Draft/draftmake/ Diff File
mod - src/Mod/Draft/draftobjects/ Diff File
mod - src/Mod/Fem/femsolver/ Diff File
mod - src/Mod/Part/BasicShapes/ Diff File
mod - src/Mod/Part/BasicShapes/ Diff File
mod - src/Mod/Test/ Diff File

Issue History

Date Modified Username Field Change
2021-01-15 06:47 ickby New Issue
2021-01-17 10:06 ickby Note Added: 0015210
2021-01-30 15:30 ickby Changeset attached => FreeCAD master 446ce215
2021-01-30 15:30 ickby Note Added: 0015228
2021-01-30 15:30 ickby Assigned To => ickby
2021-01-30 15:30 ickby Status new => closed
2021-01-30 15:30 ickby Resolution open => fixed