Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SYS(3095,oObject) has a bug
Message
De
28/11/2005 18:25:47
 
 
À
28/11/2005 17:47:47
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Divers
Thread ID:
01072326
Message ID:
01072642
Vues:
15
Hi Fabio,

this code buggy.
? "external = ", SYS(3095,ox), "Internal ",ox.IDispatch

DEFINE CLASS myclass AS session OLEPUBLIC

	PROCEDURE IDispatch
		RETURN SYS(3095,CreateObject("myserver.myclass"))
ENDDEFINE
the pointers are different of course, cause your creating a temporary COM object in the line "RETURN SYS(..." which is released directly afterwards.

or to express it in code:
&& this
PROCEDURE IDispatch
 RETURN SYS(3095,CreateObject("myserver.myclass"))
&& is the same as this
PROCEDURE IDispatch
 LOCAL loObj
 loObj = CreateObject("myserver.myclass")
 RETURN SYS(3095,loObj)
ENDPROC
so IDispatch() would return a pointer that is invalid for subsequent use, which you can easily verify:
LOCAL IExternal, IInternal, ox, ox2
ox = CreateObject("myserver.myclass")    && create the server object
IExternal = SYS(3095,ox)
IInternal = ox.IDispatch()

ox2 = SYS(3096,IExternal)
? ox = ox2
ox2 = SYS(3096,IInternal) && this completly crashes VFP9 with error ".. pure virtual function call .. " cause the pointer isn't valid anymore
Regards
Christian
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform