mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-06 05:14:13 +02:00
f83aa3f1bc
The unconditional early return was narrowed to non-directories only, so that the just-added warning badge could be picked up once setUpData() resolved m_qet_directory_unreadable asynchronously. But every directory then called setIcon() on every single data(Qt::DecorationRole) query -- not just once -- and QStandardItem::setIcon() -> setData() emits dataChanged() unconditionally (QIcon has no equality check to suppress it). QTreeView handles dataChanged() by recomputing the row's size hint, which re-enters data() for the same index, calling setIcon() again: unbounded mutual recursion, confirmed by an isolated reproduction to overflow the stack in a single frame (100k+ frames) well before the first paint completes. Matches plc-user's report of a segfault right as the elements tree begins drawing. The race the guard was widened for doesn't actually occur: ElementsCollectionModel only attaches itself to the tree view (the only way data() becomes reachable) from loadingFinished(), which fires after the QtConcurrent::map over every item -- this one included -- has already finished. m_qet_directory_unreadable is therefore always final before setUpIcon() can run for the first time, so the plain, always-only- once guard is sufficient and the badge still works correctly.