TreeViews with GeListHead and a checkbox column can lock up C4D

Just came across a bug that took me about 2 hours to figure out.

  1. Create a AutoAlloc<GeListHead> and add some child nodes. Store this in a GeDialog.
  2. In your GeDialog create a TreeView. Set the TreeViewCustomGui->SetRoot( mygelisthead->GetFirst(), &treeviewfuncs, this));
  3. In your TreeViewFunctions::GetFirst() { return root;}
  4. When setting your treeview layouts, add a checkbox. layout.SetInt32(TREE_COLUMNS_CHECK, LV_CHECKBOX);
  5. Implement the functions for IsChecked and SetCheck
  6. Run your code and when you click on the checkbox it will enter an endless loop somewhere in the c4dplugins code.

The reason for this is (2). Instead of calling SetRoot(mygelisthead->GetFirst()...). I should have just passed in the GeListHead.

Then for (3) I should have returned the First element: GeListHead op = (GeListHead)root; return op->GetFirst();

With these changes it works, but that took a while to figure out.

Hi Kent,

I'm not quite sure, if there's a question left in here?
From what I understand, we probably need to improve the TreeView documentation. But there's no bug involved on our side, right?


There is no question here. Just a bug report and a warning/info to other users if they get C4D locking up when using a treeview.