Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: skip the Assign destroy object or fire a C5 crash
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00893546
Message ID:
00893590
Views:
24

Fabio,

There is a problem here, but I'm not sure what it is. However, there is some problem with the code you present.

First,

This.MyObject = m.MyObject

never will be true. When comparing objects, always use the COMPOBJ() function. For example,

oFSO = CREATEOBJECT('Scripting.FileSystemObject')
oFSO1 = CREATEOBJECT('Scripting.FileSystemObject')
? oFSO = oFSO1 && Returns .F.
? COMPOBJ(oFSO, oFSO1) && Returns .T.

Second, you never check for NULL. If NULL is a possibility, as it is in the code you present, then you must check for that.

As a result, the line reading

IF m.THIS.myObject=m.myObject

should be changed to

IF NOT (ISNULL(this.MyObject) OR ISNULL(m.myobject)) AND COMPOBJ(This.MyObject, m.myObject)

However, while it does not generate a C5 error, the command button does disappear. As to why, I don't know.

George


My example does not use COM objects.

Please, not to create useless confusion.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform