Skip to content

Commit

Permalink
Clear gadget contents when adding new content
Browse files Browse the repository at this point in the history
In certain situations, both the Amiga and Qt versions of
CStdGadgetTree::setContent() were not clearing the underlying native
list gadget, resulting in duplicate entries in Brunel's FileTree.
  • Loading branch information
Colin Ward committed Jun 9, 2024
1 parent a9f1a04 commit 4de0942
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions StdGadgetTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,9 @@ void CStdGadgetTree::setContent(int a_contentID)

#ifdef __amigaos__

if (a_contentID == 0)
{
SetGadgetAttrs((struct Gadget *) m_poGadget, NULL, NULL, LISTBROWSER_Labels, (ULONG) NULL, TAG_DONE);
}
else
SetGadgetAttrs((struct Gadget *) m_poGadget, NULL, NULL, LISTBROWSER_Labels, (ULONG) NULL, TAG_DONE);

if (a_contentID != 0)
{
ULONG items = (ULONG) &m_itemsMap[a_contentID];

Expand Down Expand Up @@ -261,6 +259,8 @@ int CStdGadgetTree::setContent(StdList<CTreeNode> &a_items)

QList<QTreeWidgetItem *> items;

while (static_cast<QTreeWidget *>(m_poGadget)->takeTopLevelItem(0)) { }

/* Iterate through the list passed in and, for each item on the list, create a widget item to represent it, */
/* and add it to the tree widget's list of nodes */
CTreeNode *treeNode = a_items.getHead();
Expand Down

0 comments on commit 4de0942

Please sign in to comment.