fix: crash when renaming top-level folder in qt (#2230)
This commit is contained in:
parent
dc36787378
commit
8d2ca760e6
|
@ -91,9 +91,9 @@ public:
|
|||
} // namespace
|
||||
|
||||
FileTreeModel::FileTreeModel(QObject* parent, bool is_editable)
|
||||
: QAbstractItemModel(parent)
|
||||
, root_item_(new FileTreeItem)
|
||||
, is_editable_(is_editable)
|
||||
: QAbstractItemModel{ parent }
|
||||
, root_item_{ new FileTreeItem }
|
||||
, is_editable_{ is_editable }
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -320,6 +320,8 @@ void FileTreeModel::clear()
|
|||
{
|
||||
beginResetModel();
|
||||
clearSubtree(QModelIndex());
|
||||
delete root_item_;
|
||||
root_item_ = new FileTreeItem{};
|
||||
endResetModel();
|
||||
|
||||
assert(index_cache_.isEmpty());
|
||||
|
|
Loading…
Reference in New Issue