diff options
author | Neil <nyamatongwe@gmail.com> | 2019-09-28 11:22:58 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2019-09-28 11:22:58 +1000 |
commit | d120df30e5d7e4b6f23353803d271fa0425bc3cd (patch) | |
tree | 4a075d08f27739e9d9093311c397af8f3f0f7927 /qt/ScintillaEditBase/ScintillaQt.cpp | |
parent | 6de3dee515fa58510c9c0c64ed75a209a79a9dcf (diff) | |
download | scintilla-mirror-d120df30e5d7e4b6f23353803d271fa0425bc3cd.tar.gz |
Backport: Avoid calling virtual methods during destruction to stop warnings.
This code worked correctly before this change.
Backport of changeset 7693:ee3163c8c00e.
Diffstat (limited to 'qt/ScintillaEditBase/ScintillaQt.cpp')
-rw-r--r-- | qt/ScintillaEditBase/ScintillaQt.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/qt/ScintillaEditBase/ScintillaQt.cpp b/qt/ScintillaEditBase/ScintillaQt.cpp index 98a8000fa..80e1f9949 100644 --- a/qt/ScintillaEditBase/ScintillaQt.cpp +++ b/qt/ScintillaEditBase/ScintillaQt.cpp @@ -52,10 +52,8 @@ ScintillaQt::ScintillaQt(QAbstractScrollArea *parent) ScintillaQt::~ScintillaQt() { - for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) { - FineTickerCancel(tr); - } - SetIdle(false); + CancelTimers(); + ChangeIdle(false); } void ScintillaQt::execCommand(QAction *action) @@ -145,9 +143,7 @@ void ScintillaQt::Init() void ScintillaQt::Finalise() { - for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) { - FineTickerCancel(tr); - } + CancelTimers(); ScintillaBase::Finalise(); } @@ -417,6 +413,18 @@ void ScintillaQt::FineTickerStart(TickReason reason, int millis, int /* toleranc timers[reason] = startTimer(millis); } +// CancelTimers cleans up all fine-ticker timers and is non-virtual to avoid warnings when +// called during destruction. +void ScintillaQt::CancelTimers() +{ + for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) { + if (timers[tr]) { + killTimer(timers[tr]); + timers[tr] = 0; + } + } +} + void ScintillaQt::FineTickerCancel(TickReason reason) { if (timers[reason]) { @@ -433,7 +441,7 @@ void ScintillaQt::onIdle() } } -bool ScintillaQt::SetIdle(bool on) +bool ScintillaQt::ChangeIdle(bool on) { QTimer *qIdle; if (on) { @@ -459,6 +467,11 @@ bool ScintillaQt::SetIdle(bool on) return true; } +bool ScintillaQt::SetIdle(bool on) +{ + return ChangeIdle(on); +} + int ScintillaQt::CharacterSetOfDocument() const { return vs.styles[STYLE_DEFAULT].characterSet; |