How about this?<br><br>I didn&#39;t know where to add the Mutex, and I didn&#39;t think ResourceData would be appropriate. So, I implemented the Resource::Private class and added it over there. This should not break binary compatibility as it already existed. Or is there a better way?<br>
<br>- Vishesh Handa<br><br><div class="gmail_quote">On Sat, May 29, 2010 at 2:25 PM, Vishesh Handa <span dir="ltr">&lt;<a href="mailto:handa.vish@gmail.com">handa.vish@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hey Sebastian<br><br>I&#39;m sorry for the late reply I was busy with college stuff.<br><br>I looked at the modified patch, and I like the fact that it works, but I don&#39;t like the fact that we have to remember additional stuff. DetermineUri() must not me called inside ResourceData, and that you&#39;ll probably have to check if the ResourceData is stored() and its uri has been determined, before calling a method. These small things then to add up, and clutter the Resource Code.<br>

<br>Ideally I would have liked ResourceData to do all this checking itself, so that when altering the Resource class we don&#39;t have to worry about it. ( But then we already had to worry about store() ) I don&#39;t have a solution, but I&#39;m trying to figure out one.<br>

<br>I never even thought about multi-threading before this, and, yes, I too think it will crash. ( Time to add more tests? Can we add multi-threading tests? )  I was thinking of some way of checking if the determineUri lock exists, and then accordingly calling determineUri() from Resource, but I think your method of mutex locking the Resource should cover it.<br>

<br>I&#39;ll try to implement it (It pretty simple, right?)<br><font color="#888888"><br>- Vishesh Handa</font><div><div></div><div class="h5"><br><br><br><br><div class="gmail_quote">On Thu, May 27, 2010 at 5:29 PM, Sebastian Trüg <span dir="ltr">&lt;<a href="mailto:trueg@kde.org" target="_blank">trueg@kde.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Vishesh,<br>
<br>
I finally looked at the remove-proxy patch again and fixed it. Now the<br>
only problem left is the design weirdness of ResourceData instances<br>
deleting themselves.<br>
<br>
The main thing I did was removing all calls to determineUri from<br>
ResourceData and moving them into Resource. I did the same with load()<br>
and store() which is actually not necessary. Maybe it would be cleaner<br>
to move those back...<br>
<br>
I did not look into the merging of load and determineUri yet. I think we<br>
should do that in a separate patch only after we cleaned this one up.<br>
Otherwise it is impossible to debug.<br>
<br>
Cheers,<br>
<font color="#888888">Sebastian<br>
</font><div><br>
On 05/26/2010 12:52 PM, Vishesh Handa wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Wed, May 26, 2010 at 3:13 PM, Sebastian Trüg &lt;<a href="mailto:trueg@kde.org" target="_blank">trueg@kde.org</a><br>
</div><div><div></div><div>&gt; &lt;mailto:<a href="mailto:trueg@kde.org" target="_blank">trueg@kde.org</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On 05/26/2010 10:08 AM, Vishesh Handa wrote:<br>
&gt;     &gt;     &gt; 3. When checking if the the m_kickoffUri is a nie:url for a<br>
&gt;     resource.<br>
&gt;     &gt;     &gt; The nieUrl is assigned to be equal to the uri. This however<br>
&gt;     gets fixed<br>
&gt;     &gt;     &gt; in the load(). And nieUrl isn&#39;t used anywhere, so it doesn&#39;t<br>
&gt;     &gt;     matter that<br>
&gt;     &gt;     &gt; much.<br>
&gt;     &gt;<br>
&gt;     &gt;     I suppose you mean this part:<br>
&gt;     &gt;<br>
&gt;     &gt;     if( it.next() ) {<br>
&gt;     &gt;          QUrl uri = it[&quot;r&quot;].uri();<br>
&gt;     &gt;          if( uri.isEmpty() ) {<br>
&gt;     &gt;             m_uri = m_kickoffUri;<br>
&gt;     &gt;          }<br>
&gt;     &gt;          else {<br>
&gt;     &gt;             m_uri = uri;<br>
&gt;     &gt;             m_nieUrl = uri;<br>
&gt;     &gt;          }<br>
&gt;     &gt;<br>
&gt;     &gt;     The last two lines. AFAICT this is perfectly fine since in the<br>
&gt;     latter<br>
&gt;     &gt;     case both nie:url and resource URI are equal.<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt; I respectfully disagree. :)<br>
&gt;     &gt;<br>
&gt;     &gt; The query used is this &quot;select distinct ?r ?o where { { ?r nie:url<br>
&gt;     &lt;uri&gt;<br>
&gt;     &gt; . } UNION { &lt;uri&gt; ?p ?o . }  } LIMIT 1&quot;. The case where ?r isn&#39;t empty<br>
&gt;     &gt; is when the &lt;uri&gt; contains the nie:url and therefore ?r will<br>
&gt;     contain the<br>
&gt;     &gt; resource uri.<br>
&gt;<br>
&gt;     You are of course correct. It should be &quot;m_nieUrl = m_kickoffUri&quot;<br>
&gt;     instead. Agreed?<br>
&gt;<br>
&gt;<br>
&gt; Yup. :)<br>
&gt;<br>
&gt; If you get the time could you please look at my horrible merge patch?<br>
&gt;<br>
&gt; Thanks<br>
&gt; - Vishesh Handa<br>
&gt;<br>
&gt;     Cheers,<br>
&gt;     Sebastian<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>