Permalink
Browse files

Fixed: leaked QTimer object in SciDoc

  • Loading branch information...
1 parent 7f887d1 commit 373ed731456a954e09a915a41e41d55354625e91 @Mezomish committed Apr 24, 2012
Showing with 5 additions and 8 deletions.
  1. +4 −7 src/app/qsci/SciDoc.cpp
  2. +1 −1 src/lib/Settings.cpp
View
@@ -148,6 +148,10 @@ class SciDoc::Interior {
edit1_->setDocument(edit2_->document());
w->setFocusProxy(spl_);
spl_->setSizes(QList<int>() << 0 << spl_->height());
+
+ hlTimer_ = new QTimer( w );
+ hlTimer_->setSingleShot( true );
+ connect(hlTimer_, SIGNAL(timeout()), w, SLOT(highlightWord()));
}
JuffScintilla* createEdit() {
@@ -234,10 +238,6 @@ SciDoc::SciDoc(const QString& fileName) : Juff::Document(fileName) {
hlWordAct->setShortcut(QKeySequence("Ctrl+H"));
connect(hlWordAct, SIGNAL(triggered()), SLOT(highlightWord()));
addAction(hlWordAct);
-
- int_->hlTimer_ = new QTimer();
- connect(int_->hlTimer_, SIGNAL(timeout()), SLOT(highlightWord()));
- int_->hlTimer_->setSingleShot(true);
}
/*SciDoc::SciDoc(Juff::Document* doc) : Juff::Document(doc) {
@@ -980,16 +980,13 @@ void SciDoc::foldUnfoldAll() {
}
void SciDoc::highlightWord() {
- LOGGER;
-
JuffScintilla* edit = int_->curEdit_;
if ( edit == NULL ) return;
if ( edit->hasSelectedText() )
return;
QString word = edit->wordUnderCursor();
- qDebug() << word;
Juff::SearchParams params;
params.findWhat = word;
edit->highlightText(JuffScintilla::HLCurrentWord, params);
View
@@ -203,7 +203,7 @@ QVariant Settings::defaultValue(const QString& section, const QString& key) {
if ( key.compare("matchingBraceBgColor") == 0 ) return QColor(255, 200, 140);
if ( key.compare("matchingBraceFgColor") == 0 ) return QColor(0, 0, 0);
if ( key.compare("indentsColor") == 0 ) return QColor(160, 160, 160);
- if ( key.compare("wordHLColor") == 0 ) return QColor(50, 250, 50);
+ if ( key.compare("wordHLColor") == 0 ) return QColor(30, 255, 30);
if ( key.compare("searchHLColor") == 0 ) return QColor(255, 128, 0);
if ( key.compare("curLineColor") == 0 ) return QColor(240, 240, 255);
if ( key.compare("markersColor") == 0 ) return QColor(170, 170, 250);

0 comments on commit 373ed73

Please sign in to comment.