Hello<br><br><div class="gmail_quote">On Tue, Nov 29, 2011 at 7:41 PM, Juan Vuletich <span dir="ltr">&lt;<a href="mailto:juan@jvuletich.org">juan@jvuletich.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi Mariano,<div class="im"><br>
<br>
Mariano Martinez Peck wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi. I am not sure if I understand which is the bug and it is difficult to do a clear diff. You mean that weak references should NOT be serialized ?  <br>
</blockquote>
<br></div>
The test below documents the correct behavior. See implementors and senders of #nextPutWeak: in Cuis. Those methods have _very_ good comments. If you only dump a model, any views should not get dumped. If you dump a view, both view and model must be dumped. Basic View / Model separation: the View knows the Model, the Model doesn&#39;t know about the View. In the case of Morph, the owner of a morph dumped by itself should not be included; but the owner / submorphs relationship must be correct for all morphs that ultimately get dumped. The subtler bug in Cuis was in #references, and is also caught by this test.<br>

</blockquote><div><br></div><div>Thnaks, now I understand Levente&#39;s answer. I figure out how to implement it on Fuel, it should be easy.</div><div> </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

But a serialized model should be materializable in, for instance, an UI-less server, or some client with a very different UI framework, etc. This would enable (among many other useful things) sharing serialized objects between Cuis, Squeak and Pharo.<br>

</blockquote><div><br></div><div>Sorry, let me see if I understood: You mean that as the model has references to UI objects but they are just weak references, then &quot;Serializer serialize: model&quot; should not include UI objects and thus you can transport the model with UI-framework independence. Am I right?</div>

<div><br></div><div>Cheers,</div><div>Martín</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks in advance!<br>
</blockquote>
<br>
<br>
Cheers,<br><font color="#888888">
Juan Vuletich<br>
<br>
</font><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Sun, Nov 27, 2011 at 6:28 PM, Juan Vuletich &lt;<a href="mailto:juan@jvuletich.org" target="_blank">juan@jvuletich.org</a> &lt;mailto:<a href="mailto:juan@jvuletich.org" target="_blank">juan@jvuletich.org</a>&gt;&gt; wrote:<br>


<br>
    Hi Folks,<br>
<br>
    I found a bug in Cuis that made weak references to be improperly<br>
    dumped in SmartRefStreams due to a bug in ReferenceStream. When I<br>
    tried to reproduce the bug and fix in Squeak, I found out that in<br>
    Squeak weak references are always dumped (and not just the more<br>
    subtle bug in Cuis). The attach includes a test and fix. I&#39;m<br>
    confident about the fix in the context of Cuis, but I only played<br>
    a few minutes with this in Squeak.<br>
<br>
    Can anybody check this for Squeak and consider it for inclusion?<br>
<br>
    Thanks,<br>
    Juan Vuletich<br>
<br></div>
    ...<div><div></div><div class="h5"><br>
<br>
<br>
    !ReferenceStreamTest methodsFor: &#39;testing&#39; stamp: &#39;jmv 11/27/2011<br>
    14:56&#39;!<br>
    testWeakDumps<br>
           &quot;Test that if we serialize a model with weak references to<br>
    views, only the model is serialized and not the views.<br>
<br>
           Note: The bug became apparent only when dumping a model to<br>
    a SmartRefStream, that calls #references, and the serialized stream<br>
           was later materialized in an image where the view classes<br>
    had been deleted. In such rare cases, materialization would fail<br>
    when trying to reference these<br>
           absent classes. If serializing to a ReferenceStream, the<br>
    bug didn&#39;t become apparent (views were never serialized). If<br>
    serializing to a SmartRefStream, but<br>
           view classes still existed, the bug didn&#39;t really become<br>
    apparent (because views were not actually deserialized), the only<br>
    effect was a larger file.<br>
<br>
           ReferenceStreamTest new testWeakDumps<br>
           &quot;<br>
           | oldInstance refStream |<br>
           oldInstance :=StringHolder new contents: &#39;This is a text&#39;.<br>
           oldInstance addDependent: Morph new.<br>
           refStream := ReferenceStream on: (DummyStream on: nil).<br>
           refStream nextPut: oldInstance.<br>
           self deny: (refStream references keys anySatisfy: [<br>
    :dumpedObject | dumpedObject isKindOf: Morph ])! !<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
-- <br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a><br>
</div></div></blockquote>
<br>
<br>
</blockquote></div><br>