Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: skip the Assign destroy object or fire a C5 crash
Message
De
09/04/2004 10:51:18
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
BUG: skip the Assign destroy object or fire a C5 crash
Divers
Thread ID:
00893546
Message ID:
00893546
Vues:
75
On VFP is not possible ignore a property assign for a object reference.
If you define a property for a object reference, and a property_Assign procedure,
then you must write the object reference into the property_Assign procedure

Repro Click 3 times on command button:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	myobject = .NULL.

	ADD OBJECT command1 AS commandbutton WITH left = 150, Top = 50,AutoSize = .T.

	PROCEDURE myobject_assign
		LPARAMETERS myObject
		IF m.THIS.myObject=m.myObject
*			this.myObject = m.myObject && you must exec this assign
			RETURN
		ENDIF
		* here exists code that i want skip if m.THIS.myObject=m.myObject
		THIS.myObject = m.myObject
	ENDPROC


	PROCEDURE command1.Click
		THISFORM.MYobject= m.This
	ENDPROC

ENDDEFINE
Explain:
* form builded
* command1.RefCounter = 1

* User Click 1
THISFORM.MYobject= m.This
* VFP compare m.THIS.myObject (NULL) with m.This,
* they are not equal VFP, continue
* call myobject_assign
...
THIS.myObject = m.myObject
* command1.RefCounter = 2

* User Click 2
THISFORM.MYobject= m.This
* VFP compare m.THIS.myObject (Command1) with m.This,
* they are equal VFP, VFP sub 1 by command1.RefCounter  && this is the bug cause
* command1.RefCounter = 1
* call myobject_assign
...

* User Click 3
THISFORM.MYobject= m.This
* VFP compare m.THIS.myObject (Command1) with m.This,
* they are equal VFP, VFP sub 1 by command1.RefCounter 
* command1.RefCounter = 0 ===> VFP release the CommandObject
* call myobject_assign
...
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform