Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/notelistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,24 @@ void NoteListView::setEditorWidget(int noteId, QWidget *w)

void NoteListView::unsetEditorWidget(int noteId, QWidget *w)
{
if (m_openedEditor.contains(noteId)) {
m_openedEditor[noteId].removeAll(w);
// Skip if trying to remove nullptr - this is a no-op and can cause
// issues during destruction when the map state may be inconsistent
if (w == nullptr) {
return;
}
auto it = m_openedEditor.find(noteId);
if (it != m_openedEditor.end()) {
it.value().removeAll(w);
}
}

void NoteListView::closeAllEditor()
{
// Check if model is still valid before iterating
if (!model()) {
m_openedEditor.clear();
return;
}
for (const auto &id : m_openedEditor.keys()) {
auto index = static_cast<NoteListModel *>(model())->getNoteIndex(id);
closePersistentEditor(index);
Expand Down