Skip to content

Commit

Permalink
Merge pull request #209 from boo-yee/develop
Browse files Browse the repository at this point in the history
Fix the issue: regression since v2.1.9: nixnote2 no longer exiting cleanly (terminated by SIGABRT) #208
  • Loading branch information
robert7 authored Aug 5, 2023
2 parents 42acd76 + 3c1ace0 commit eaba2d8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/gui/nbrowserwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ NBrowserWindow::NBrowserWindow(QWidget *parent) :
NBrowserWindow::~NBrowserWindow() {
browserThread->quit();
while (!browserRunner->isIdle);
while (!browserThread->isFinished());

delete browserThread;
delete browserRunner;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/nmainmenubar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 3 additions & 11 deletions src/nixnote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1299,10 +1300,6 @@ void NixNote::saveOnExit() {
saveNoteColumnPositions();
noteTableView->saveColumnsVisible();

QLOG_DEBUG() << "saveOnExit: Closing threads";
indexThread.quit();
counterThread.quit();

QLOG_DEBUG() << "Exiting saveOnExit()";
}

Expand Down Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion src/nixnote.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class NixNote : public QMainWindow
LineEdit *searchText;
NTabWidget *tabWindow;
void showAnnouncementMessage();
void resetNoteTableSortColumn();
void unsortNoteTable();

private slots:
void onNetworkManagerFinished(QNetworkReply *reply);
Expand Down

0 comments on commit eaba2d8

Please sign in to comment.