diff --git a/src/gui/nbrowserwindow.cpp b/src/gui/nbrowserwindow.cpp index 940ebd58..19904588 100644 --- a/src/gui/nbrowserwindow.cpp +++ b/src/gui/nbrowserwindow.cpp @@ -308,6 +308,7 @@ NBrowserWindow::NBrowserWindow(QWidget *parent) : NBrowserWindow::~NBrowserWindow() { browserThread->quit(); while (!browserRunner->isIdle); + while (!browserThread->isFinished()); delete browserThread; delete browserRunner; diff --git a/src/gui/nmainmenubar.cpp b/src/gui/nmainmenubar.cpp index 5ae9a258..5226d1b8 100644 --- a/src/gui/nmainmenubar.cpp +++ b/src/gui/nmainmenubar.cpp @@ -645,7 +645,7 @@ void NMainMenuBar::onSortMenuTriggered() { QString data = pAction->data().toString(); QLOG_DEBUG() << "sort action data= " << data; global.setSortOrder(data); - parent->resetNoteTableSortColumn(); + parent->unsortNoteTable(); // refresh result set parent->updateSelectionCriteria(false); diff --git a/src/nixnote.cpp b/src/nixnote.cpp index f3c62d09..07ffb24b 100644 --- a/src/nixnote.cpp +++ b/src/nixnote.cpp @@ -243,6 +243,7 @@ NixNote::NixNote(QWidget *parent) : QMainWindow(parent) { // Destructor to call when all done NixNote::~NixNote() { + QLOG_DEBUG() << "~NixNote: Closing threads"; syncThread.quit(); indexThread.quit(); counterThread.quit(); @@ -1299,10 +1300,6 @@ void NixNote::saveOnExit() { saveNoteColumnPositions(); noteTableView->saveColumnsVisible(); - QLOG_DEBUG() << "saveOnExit: Closing threads"; - indexThread.quit(); - counterThread.quit(); - QLOG_DEBUG() << "Exiting saveOnExit()"; } @@ -3732,13 +3729,8 @@ void NixNote::showAnnouncementMessage() { } -void NixNote::resetNoteTableSortColumn() { - // Sort the notetableview by a non-existing column, to reset the sort column. - // This function is only called after the sort menu's item is clicked. - // Without calling this function, the sort will not work, because the - // notetableview is set to sortable(setSortingEnabled(true)), and within - // setSortingEnabled(), a normal sortBycolumn() is called, which will lock - // the items order. +void NixNote::unsortNoteTable() { + // Sort the notetableview by a non-existing column int sortColumn = noteTableView->horizontalHeader()->count(); noteTableView->sortByColumn(sortColumn); } diff --git a/src/nixnote.h b/src/nixnote.h index 4b40130a..0f985e0c 100644 --- a/src/nixnote.h +++ b/src/nixnote.h @@ -204,7 +204,7 @@ class NixNote : public QMainWindow LineEdit *searchText; NTabWidget *tabWindow; void showAnnouncementMessage(); - void resetNoteTableSortColumn(); + void unsortNoteTable(); private slots: void onNetworkManagerFinished(QNetworkReply *reply);