Hi Mattias,<div><br><div class="gmail_quote">On 24 April 2011 09:31, Mattias Gaertner <span dir="ltr"><<a href="mailto:nc-gaertnma@netcologne.de">nc-gaertnma@netcologne.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On Sun, 24 Apr 2011 08:58:07 +1000<br>
Peter E Williams <<a href="mailto:pewslinuxvault@gmail.com">pewslinuxvault@gmail.com</a>> wrote:<br>
<br>
> Hi All,<br>
><br>
> I am having a problem with a strange run-time AV error. See the link to the<br>
> Lazarus project.<br>
><br>
> Download link:<br>
> <a href="http://hotfile.com/dl/115480488/6b7a8ed/dtm_maker_001.zip.html" target="_blank">http://hotfile.com/dl/115480488/6b7a8ed/dtm_maker_001.zip.html</a><br>
><br>
> The problem is in the QSort procedure:<br>
><br>
</div>>[...]<br>
<div class="im">>     pivot := island_single_array[left].location_number;<br>
<br>
</div>"pivot" is the key of the pivot element at position "left".<br>
<br>
>[...]<br>
<div class="im">>     pivot := island_single_array[left].location_number;<br>
>     left := lower1;<br>
>     right := upper1;<br>
>     if left < pivot then<br>
</div>         ^^^^^^^^^^^^<br>
Comparing a position and a key makes no sense.<br>
<br>
You have to keep track of the position of the pivot element. See the<br>
quicksort implementation in TFPList.Sort.<br>
<br></blockquote><div><br></div><div>Could you please give me a link to the TFPList.Sort code so that I can use that code (via cut and paste) in my unit ? </div><div><br></div><div>Thanks and best regards,</div><div>Peter / pew</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Mattias<br>
<font color="#888888"><br>
--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</font></blockquote></div><br></div>