Page 1 of 1

0.5.0 and ItemListBase

Posted: Fri May 19, 2006 05:54
by Turtle
Hi lindquist,

Following up from the pms, when I put in your changes to resetList_impl I found that when I populated the list, did a resetList on it, and then repopulated the list once more with ItemEntrys that have the same name, then I'd get the error message:

A Window object with the name 'Blah' already exists within the system


I did a quick check of the new section:

Code: Select all

      while (!d_listItems.empty())
      {
         d_pane->removeChildWindow(d_listItems[0]);
         if (d_listItems[0]->isDestroyedByParent())
         {
            WindowManager::getSingleton().destroyWindow(d_listItems[0]);
         }
      }


And it appears that both the removeChildWindow and the destroyWindow result in the d_listItems vector dropping an ItemEntry so two are lost each loop, but one is removed as a Child window and not destroyed, while the second one is destroyed but not removed as a Child window.

I tried the following code and it seems to work without this problem:

Code: Select all

      while (!d_listItems.empty())
      {
         ItemEntry* entry = d_listItems[0];
         d_pane->removeChildWindow(entry);
         if (entry->isDestroyedByParent())
         {
            WindowManager::getSingleton().destroyWindow(entry);
         }
      }


I have to admit that I've only given it a quick test however.

Cheers.
:D

Posted: Fri May 19, 2006 14:06
by lindquist
You are right, the fix in PMd you was broken too :P
I fixed it just like you propose and it is in svn trunk already.

Posted: Sat May 20, 2006 09:29
by Turtle
Thanks lindquist.

:)