Now the AppCafe crash when the last item is removed is fixed. Looks like we found a Qt bug with QTreeWidget and removing the last item with takeTopLevelItem().