<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello Antoine,<br>
<br>
Thanks for your answer. I am afraid that, from a user point of
view -- that's mine--, it is hard to understand in pratical the
way it works, and why it works like this:<br>
<br>
Le 30/07/2018 à 00:55, Antoine ELIAS a écrit :<br>
</div>
<blockquote
cite="mid:8923c98b-444f-e9ca-79c0-a9c347e07932@scilab-enterprises.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
Hello Samuel,<br>
<br>
In XMLObject there is two levels of reference, <br>
- one on MList (managed by reference counter)<br>
- one on internal XMLObject (internally manager like handle, an
integer that link to a C++ object)<br>
<br>
xmlDelete destroy internal XMLObject<br>
clear destroy (unreference and destroy if ref <= 1 ) MList
object.<br>
</blockquote>
<br>
How is it possible to illustrate all this with Scilab instructions
and tests?<br>
In what you describe, i don't see any difference between Scilab 5
and Scilab 6,<br>
contrarily to Calixte's announcement, noticeably about the way
clear() works.<br>
<br>
<blockquote
cite="mid:8923c98b-444f-e9ca-79c0-a9c347e07932@scilab-enterprises.com"
type="cite"> <br>
So in your case, after a xmlDelete, the internal XMLObject was
destroyed but not the MList.<br>
And after a clear doc, the MList was destroyed but the internal
XMLObject not.<br>
</blockquote>
<br>
Yes, i understand all that.<br>
<br>
<blockquote
cite="mid:8923c98b-444f-e9ca-79c0-a9c347e07932@scilab-enterprises.com"
type="cite"> Current XMLObject is based on simple MList with the
id of the doc ( store as double ).<br>
If we want to correctly destroy the internal XMLObject with the
clear command.<br>
We must change the implementation to use types::UserType instead
of types::Double and uses destructor of UserType to free
XMLObject.<br>
</blockquote>
<br>
So, is this the new possible feature of Scilab 6 vs Scilab 5?<br>
In this way, i am not sure that this would be the most interesting
evolution.<br>
Even if an open document has no local handle, it is still possible
to retrieve<br>
an access to open ones, and from everywhere, with <span
class="functionid">xmlGetOpenDocs</span><span class="default">().<br>
That's nice.<br>
</span><br>
<blockquote
cite="mid:8923c98b-444f-e9ca-79c0-a9c347e07932@scilab-enterprises.com"
type="cite"> > Deleting an object should clear all its
pointers. For instance, with the XML example<br>
> hereabove, deleting the document should clear doc and doc2.<br>
I am not agree with that, I cannot delete an user variable
indirectly. ( xmlDelete(doc) that will delete doc )<br>
Only clear command can do that. For me it will be a bad practice.<br>
</blockquote>
<br>
Why?! This is the key point. It holds in the same way for graphic
handles.<br>
I would like very much to read and understand rationales about this
point.<br>
From a user point of view, i don't see a single reason or interest
in<br>
keeping "invalid handles" or "invalid XML documents", that's to say,<br>
clearly, keeping some pending pointers! These are dead and
completely useless<br>
objects, since there is no way to recover the deleted target.<br>
So, what's the interest in using is_handle_valid(h) instead of
simply isdef("h")??<br>
What's the interest of using <span class="functionid">xmlIsValidObject</span><span
class="default">(doc) instead of isdef("doc")?<br>
With such a current implementation, if we have created many alias
of an handle,<br>
then there are as many obsolete aliases that are pending pointers.<br>
<br>
If you have in mind a single situation for which this
implementation has<br>
an interest (compared to an automatical clearing of invalid
handles)<br>
it would be great to share it.<br>
</span><span class="default"></span>
<div class="refsynopsisdiv"><span class="default"><br>
</span> </div>
Usually, leaving pending pointers is the bad practice, not removing
them.<br>
Isn't it?<br>
<br>
Best regards<br>
Samuel<br>
<br>
</body>
</html>