author | paule <paule> | 2007-01-13 07:03:58 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-13 07:03:58 (UTC) |
commit | 75c65c1dc728929f0430b8faf956195657b73311 (patch) (side-by-side diff) | |
tree | 52fce1ccec59285e4e887d908b0da3a0431c13d9 /noncore | |
parent | e9768d9a498037195b8ca3bb5155db7419f30e1a (diff) | |
download | opie-75c65c1dc728929f0430b8faf956195657b73311.zip opie-75c65c1dc728929f0430b8faf956195657b73311.tar.gz opie-75c65c1dc728929f0430b8faf956195657b73311.tar.bz2 |
Call qApp->processEvents() before deleting dialog objects to avoid crashes (Qt bug?)
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateview.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp index 423634b..c5673a5 100644 --- a/noncore/apps/tinykate/libkate/view/kateview.cpp +++ b/noncore/apps/tinykate/libkate/view/kateview.cpp @@ -1864,123 +1864,126 @@ void KateView::find() { SearchDialog *searchDialog; if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected; searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList, searchFlags & ~KateView::sfReplace); // If the user has marked some text we use that otherwise // use the word under the cursor. QString str; if (myDoc->hasMarkedText()) str = markedText(); if (str.isEmpty()) str = currentWord(); if (!str.isEmpty()) { str.replace(QRegExp("^\n"), ""); int pos=str.find("\n"); if (pos>-1) str=str.left(pos); searchDialog->setSearchText( str ); } myViewInternal->focusOutEvent(0L);// QT bug ? if (searchDialog->exec() == QDialog::Accepted) { kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); searchFlags = searchDialog->getFlags() | (searchFlags & KateView::sfPrompt); initSearch(s, searchFlags); findAgain(s); } + qApp->processEvents(); delete searchDialog; } void KateView::replace() { SearchDialog *searchDialog; if (isReadOnly()) return; if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected; searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList, searchFlags | KateView::sfReplace); // If the user has marked some text we use that otherwise // use the word under the cursor. QString str; if (myDoc->hasMarkedText()) str = markedText(); if (str.isEmpty()) str = currentWord(); if (!str.isEmpty()) { str.replace(QRegExp("^\n"), ""); int pos=str.find("\n"); if (pos>-1) str=str.left(pos); searchDialog->setSearchText( str ); } myViewInternal->focusOutEvent(0L);// QT bug ? if (searchDialog->exec() == QDialog::Accepted) { // myDoc->recordReset(); kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); kwview_addToStrList(myDoc->replaceWithList, searchDialog->getReplaceWith()); searchFlags = searchDialog->getFlags(); initSearch(s, searchFlags); replaceAgain(); } + qApp->processEvents(); delete searchDialog; } void KateView::gotoLine() { GotoLineDialog *dlg; PointStruc cursor; dlg = new GotoLineDialog(this, myViewInternal->cursor.y + 1, myDoc->numLines()); // dlg = new GotoLineDialog(myViewInternal->cursor.y + 1, this); if (dlg->exec() == QDialog::Accepted) { // myDoc->recordReset(); cursor.x = 0; cursor.y = dlg->getLine() - 1; myDoc->needPreHighlight(cursor.y); myViewInternal->updateCursor(cursor); myViewInternal->center(); myViewInternal->updateView(KateView::ufUpdateOnScroll); myDoc->updateViews(this); //uptade all other views except this one } + qApp->processEvents(); delete dlg; } void KateView::initSearch(SConfig &s, int flags) { s.flags = flags; s.setPattern(myDoc->searchForList.first()); if (!(s.flags & KateView::sfFromBeginning)) { // If we are continuing a backward search, make sure we do not get stuck // at an existing match. s.cursor = myViewInternal->cursor; TextLine::Ptr textLine = myDoc->getTextLine(s.cursor.y); QString const txt(textLine->getText(),textLine->length()); const QString searchFor= myDoc->searchForList.first(); int pos = s.cursor.x-searchFor.length()-1; if ( pos < 0 ) pos = 0; pos= txt.find(searchFor, pos, s.flags & KateView::sfCaseSensitive); if ( s.flags & KateView::sfBackward ) { if ( pos <= s.cursor.x ) s.cursor.x= pos-1; } else if ( pos == s.cursor.x ) s.cursor.x++; } else { if (!(s.flags & KateView::sfBackward)) { s.cursor.x = 0; s.cursor.y = 0; } else { s.cursor.x = -1; s.cursor.y = myDoc->lastLine(); |