Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: PictureVal reassign the same OS object picture
Message
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
BUG: PictureVal reassign the same OS object picture
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01020236
Message ID:
01020236
Views:
91
Reassign the same OS's object reference to a Image.PicturVal,
the OS's picture object it is released.

Repro:
CLEAR
oPicture1 = LOADPICTURE(HOME(4)+"\Bitmaps\Tlbr_w95\ARC.BMP")
oPicture2 = LOADPICTURE(HOME(4)+"\Bitmaps\Tlbr_w95\BACK.BMP")

WITH CREATEOBJECT("image")
	.PictureVal = m.oPicture1
	.PictureVal = m.oPicture2
	.PictureVal = m.oPicture1
	.PictureVal = m.oPicture2
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
	* reassign the same image
	.PictureVal = m.oPicture2
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
	.PictureVal = m.oPicture1
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
	* reassign the same image
	.PictureVal = m.oPicture1
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
ENDWITH

RELEASE oPicture1,oPicture2

* workaround it is obvious : clear the PictureVal before to reassign

? "WORKAROUND"

oPicture1 = LOADPICTURE(HOME(4)+"\Bitmaps\Tlbr_w95\ARC.BMP")
oPicture2 = LOADPICTURE(HOME(4)+"\Bitmaps\Tlbr_w95\BACK.BMP")

WITH CREATEOBJECT("image")
	.PictureVal = m.oPicture1
	.PictureVal = m.oPicture2
	.PictureVal = m.oPicture1
	.PictureVal = m.oPicture2
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
	* reassign the same image
	.PictureVal = 0h
	.PictureVal = m.oPicture2
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
	.PictureVal = m.oPicture1
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
	* reassign the same image
	.PictureVal = 0h
	.PictureVal = m.oPicture1
	? "handles",m.oPicture1.Handle,m.oPicture2.Handle,"objects" at 40,m.oPicture1,m.oPicture2
ENDWITH

RELEASE oPicture1,oPicture2
Work with Pictures collection, remove the collection Item.

Fabio
Next
Reply
Map
View

Click here to load this message in the networking platform