Skip to content

Commit

Permalink
Fixed: leaked QTimer object in SciDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mezomish committed Apr 24, 2012
1 parent 7f887d1 commit 373ed73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/app/qsci/SciDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 373ed73

Please sign in to comment.