ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Copy ObjUserData between images issue??
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

superdev

19 Posts

Posted - Jan 20 2023 :  17:02:34  Show Profile  Reply
I put two ImageEnVerts, A and B, and put a Box in A ImageEnVert using ObjUserData. When saving and loading in A, I confirmed that ObjUserData is saved and loaded. However, after assigning A to B, ObjUserData is not included when saving and loading B. How to Assign from A->B with ObjUserData ?

xequte

38180 Posts

Posted - Jan 21 2023 :  15:53:16  Show Profile  Reply
Hi

That is correct. Object user data is not transferred when assigning because of the risk of memory leakage (ownership of the memory).

You should manually transfer the user data to the new object, e.g.

oldObj := GetObj( OldIndex );
newObj := GetObj( NewIndex );
newObj^.UserData       := oldObj^.UserData;
newObj^.UserDataLength := oldObj^.UserDataLength;
oldObj^.UserData       := nil;
oldObj^.UserDataLength := 0;



Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: