File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88 scans while typing when the backlink inputs did not change, and by computing
99 backlink-relative note paths without touching every note file on disk
1010 (for [#3587](https://github.com/pbek/QOwnNotes/issues/3587))
11+ - Fixed a crash when closing QOwnNotes while **LanguageTool** was active by
12+ clearing checker state without triggering editor rehighlighting during text
13+ edit destruction (for [#3496](https://github.com/pbek/QOwnNotes/issues/3496))
1114
1215## 26.6.3
1316
Original file line number Diff line number Diff line change @@ -68,15 +68,15 @@ void HarperChecker::setTextEdit(QPlainTextEdit *textEdit) {
6868 scheduleCheck (true );
6969}
7070
71- void HarperChecker::clearForTextEdit (QPlainTextEdit *textEdit) {
71+ void HarperChecker::clearForTextEdit (QPlainTextEdit *textEdit, bool updateBlocks ) {
7272 if (_textEdit == textEdit) {
73- clearCurrentState ();
73+ clearCurrentState (updateBlocks );
7474 _textEdit.clear ();
7575 _document.clear ();
7676 }
7777}
7878
79- void HarperChecker::clearCurrentState () {
79+ void HarperChecker::clearCurrentState (bool updateBlocks ) {
8080 _debounceTimer->stop ();
8181 _client->cancelAllRequests ();
8282 _pendingRequests.clear ();
@@ -88,7 +88,9 @@ void HarperChecker::clearCurrentState() {
8888 if (oldAvailable != _available) {
8989 Q_EMIT availabilityChanged (_available);
9090 }
91- Q_EMIT blockMatchesUpdated (QVector<int >());
91+ if (updateBlocks) {
92+ Q_EMIT blockMatchesUpdated (QVector<int >());
93+ }
9294}
9395
9496void HarperChecker::invalidateBlock (int blockNumber) { _cache.remove (blockNumber); }
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ class HarperChecker : public QObject {
3131 static HarperChecker *instance ();
3232
3333 void setTextEdit (QPlainTextEdit *textEdit);
34- void clearForTextEdit (QPlainTextEdit *textEdit);
35- void clearCurrentState ();
34+ void clearForTextEdit (QPlainTextEdit *textEdit, bool updateBlocks = true );
35+ void clearCurrentState (bool updateBlocks = true );
3636 void invalidateBlock (int blockNumber);
3737 void scheduleCheck (bool immediate = false );
3838 void recheckNow ();
Original file line number Diff line number Diff line change @@ -70,22 +70,24 @@ void LanguageToolChecker::setTextEdit(QPlainTextEdit *textEdit) {
7070 scheduleCheck (true );
7171}
7272
73- void LanguageToolChecker::clearForTextEdit (QPlainTextEdit *textEdit) {
73+ void LanguageToolChecker::clearForTextEdit (QPlainTextEdit *textEdit, bool updateBlocks ) {
7474 if (_textEdit == textEdit) {
75- clearCurrentState ();
75+ clearCurrentState (updateBlocks );
7676 _textEdit.clear ();
7777 _document.clear ();
7878 }
7979}
8080
81- void LanguageToolChecker::clearCurrentState () {
81+ void LanguageToolChecker::clearCurrentState (bool updateBlocks ) {
8282 _debounceTimer->stop ();
8383 _client->cancelAllRequests ();
8484 _pendingRequests.clear ();
8585 _pendingRequestId = 0 ;
8686 _cache.clear ();
8787 _warningShown = false ;
88- Q_EMIT blockMatchesUpdated (QVector<int >());
88+ if (updateBlocks) {
89+ Q_EMIT blockMatchesUpdated (QVector<int >());
90+ }
8991}
9092
9193void LanguageToolChecker::invalidateBlock (int blockNumber) { _cache.remove (blockNumber); }
Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ class LanguageToolChecker : public QObject {
3030 static LanguageToolChecker *instance ();
3131
3232 void setTextEdit (QPlainTextEdit *textEdit);
33- void clearForTextEdit (QPlainTextEdit *textEdit);
34- void clearCurrentState ();
33+ void clearForTextEdit (QPlainTextEdit *textEdit, bool updateBlocks = true );
34+ void clearCurrentState (bool updateBlocks = true );
3535 void invalidateBlock (int blockNumber);
3636 void scheduleCheck (bool immediate = false );
3737 void recheckNow ();
Original file line number Diff line number Diff line change @@ -3619,10 +3619,10 @@ QOwnNotesMarkdownTextEdit::~QOwnNotesMarkdownTextEdit() {
36193619 qDebug () << " *** QOwnNotesMarkdownTextEdit DESTROYED ***" << this << objectName ();
36203620 closeMarkdownLspDocument ();
36213621#ifdef LANGUAGETOOL_ENABLED
3622- LanguageToolChecker::instance ()->clearForTextEdit (this );
3622+ LanguageToolChecker::instance ()->clearForTextEdit (this , false );
36233623#endif
36243624#ifdef HARPER_ENABLED
3625- HarperChecker::instance ()->clearForTextEdit (this );
3625+ HarperChecker::instance ()->clearForTextEdit (this , false );
36263626#endif
36273627 // Unregister if this was the active editor
36283628 unregisterAsActiveEditor ();
You can’t perform that action at this time.
0 commit comments