title: Deleting items within Listbox that contains Group Headers
body: <p>I am using Delphi XE5, working on an iOS application. I have come across an access violation that occurs during my application when deleting all items from a Listbox using for example:</p>
  
  <pre><code>ListBox1.beginUpdate;
  ListBox1.items.clear;
  // do work, to re-add new data to list box
  ...
  Listbox1.endUpdate;
  </code></pre>
  
  <p>Normally, the code above works fine and no errors occur, in fact, all the items currently get deleted from that list box. EXCEPT - I get an access violation. The only difference with this TListBox in particular compared to others, is that it has TListboxGroupHeaderItems.</p>
  
  <p>My work-around has been the following solution: </p>
  
  <pre><code>ListBox1.BeginUpdate;
  p := Listbox1.Items.Count;
  while p &lt;&gt; 0 do begin
    ListBox1.Items.Delete(p-1)
    p := p - 1;
  end;
  // Do Work, re-add new data, etc.
  ....
  ListBox1.endUpdate;
  </code></pre>
  
  <p>Anyone know of a proper way to clear all items, including groupHeaders from a TListbox without triggering an access violation ? Or is it something else wrong that I am doing ?
  When ran in the debugger, it does break on <code>ListBox1.items.clear;</code></p>
  
  <p>Update (10/14/2013 2:14PM): 
  No Error message when working in iOS 6 Device/Simulator, but error does occur when working with iOS7</p>