Select to view content in your preferred language

Pure Python COM objects cause Beta 2 crash

2489
4
02-12-2010 05:55 AM
MarkCederholm
Regular Contributor II
Pure Python COM objects work just fine in ArcGIS 9.3.1, but in Beta 2 they cause ArcMap and ArcCatalog to crash on closing.  Here's a simple test:

1) Create a simple COM object using the instructions at:
http://starship.python.net/crew/theller/comtypes/server.html

2) Open ArcMap or ArcCatalog and type the following in the Python window:
from comtypes.client import CreateObject
o = CreateObject("MyTypeLib.MyObject")

3) Close ArcMap or ArcCatalog

4) Boom! 😉
0 Kudos
4 Replies
JasonScheirer
Regular Contributor II
Looks like a double free on the COM object when ArcMap/Catalog closes down the Python interpreter for that process. Are there any known issues in COMTypes itself? Is there an explicit addref call you need to execute on the object when you start using it?

We don't link against a debug build of Python in the ArcObjects stack, so I can't dig too much further into the Python to see what's going on here. Sorry.
0 Kudos
MarkCederholm
Regular Contributor II
CreateObject automatically adds a ref, just as del automatically removes it.  Even after the object is supposedly freed, the bomb still occurs.  I tried adding an extra ref and that did no good.  I know of no current issues with comypes but I'll do some looking; no bombs occur when the object is used in a normal Python session.
0 Kudos
MarkCederholm
Regular Contributor II
Looks like it's fixed in the RC!
0 Kudos
JasonScheirer
Regular Contributor II
Awesome, good to hear.
0 Kudos