author | paule <paule> | 2007-01-13 07:03:58 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-13 07:03:58 (UTC) |
commit | 75c65c1dc728929f0430b8faf956195657b73311 (patch) (unidiff) | |
tree | 52fce1ccec59285e4e887d908b0da3a0431c13d9 | |
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 | |||
@@ -1884,24 +1884,25 @@ void KateView::find() { | |||
1884 | if (pos>-1) | 1884 | if (pos>-1) |
1885 | str=str.left(pos); | 1885 | str=str.left(pos); |
1886 | searchDialog->setSearchText( str ); | 1886 | searchDialog->setSearchText( str ); |
1887 | } | 1887 | } |
1888 | 1888 | ||
1889 | myViewInternal->focusOutEvent(0L);// QT bug ? | 1889 | myViewInternal->focusOutEvent(0L);// QT bug ? |
1890 | if (searchDialog->exec() == QDialog::Accepted) { | 1890 | if (searchDialog->exec() == QDialog::Accepted) { |
1891 | kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); | 1891 | kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); |
1892 | searchFlags = searchDialog->getFlags() | (searchFlags & KateView::sfPrompt); | 1892 | searchFlags = searchDialog->getFlags() | (searchFlags & KateView::sfPrompt); |
1893 | initSearch(s, searchFlags); | 1893 | initSearch(s, searchFlags); |
1894 | findAgain(s); | 1894 | findAgain(s); |
1895 | } | 1895 | } |
1896 | qApp->processEvents(); | ||
1896 | delete searchDialog; | 1897 | delete searchDialog; |
1897 | } | 1898 | } |
1898 | 1899 | ||
1899 | void KateView::replace() { | 1900 | void KateView::replace() { |
1900 | SearchDialog *searchDialog; | 1901 | SearchDialog *searchDialog; |
1901 | 1902 | ||
1902 | if (isReadOnly()) return; | 1903 | if (isReadOnly()) return; |
1903 | 1904 | ||
1904 | if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected; | 1905 | if (!myDoc->hasMarkedText()) searchFlags &= ~KateView::sfSelected; |
1905 | searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList, | 1906 | searchDialog = new SearchDialog(this, myDoc->searchForList, myDoc->replaceWithList, |
1906 | searchFlags | KateView::sfReplace); | 1907 | searchFlags | KateView::sfReplace); |
1907 | 1908 | ||
@@ -1923,44 +1924,46 @@ void KateView::replace() { | |||
1923 | searchDialog->setSearchText( str ); | 1924 | searchDialog->setSearchText( str ); |
1924 | } | 1925 | } |
1925 | 1926 | ||
1926 | myViewInternal->focusOutEvent(0L);// QT bug ? | 1927 | myViewInternal->focusOutEvent(0L);// QT bug ? |
1927 | if (searchDialog->exec() == QDialog::Accepted) { | 1928 | if (searchDialog->exec() == QDialog::Accepted) { |
1928 | // myDoc->recordReset(); | 1929 | // myDoc->recordReset(); |
1929 | kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); | 1930 | kwview_addToStrList(myDoc->searchForList, searchDialog->getSearchFor()); |
1930 | kwview_addToStrList(myDoc->replaceWithList, searchDialog->getReplaceWith()); | 1931 | kwview_addToStrList(myDoc->replaceWithList, searchDialog->getReplaceWith()); |
1931 | searchFlags = searchDialog->getFlags(); | 1932 | searchFlags = searchDialog->getFlags(); |
1932 | initSearch(s, searchFlags); | 1933 | initSearch(s, searchFlags); |
1933 | replaceAgain(); | 1934 | replaceAgain(); |
1934 | } | 1935 | } |
1936 | qApp->processEvents(); | ||
1935 | delete searchDialog; | 1937 | delete searchDialog; |
1936 | } | 1938 | } |
1937 | 1939 | ||
1938 | void KateView::gotoLine() { | 1940 | void KateView::gotoLine() { |
1939 | GotoLineDialog *dlg; | 1941 | GotoLineDialog *dlg; |
1940 | PointStruc cursor; | 1942 | PointStruc cursor; |
1941 | 1943 | ||
1942 | dlg = new GotoLineDialog(this, myViewInternal->cursor.y + 1, myDoc->numLines()); | 1944 | dlg = new GotoLineDialog(this, myViewInternal->cursor.y + 1, myDoc->numLines()); |
1943 | // dlg = new GotoLineDialog(myViewInternal->cursor.y + 1, this); | 1945 | // dlg = new GotoLineDialog(myViewInternal->cursor.y + 1, this); |
1944 | 1946 | ||
1945 | if (dlg->exec() == QDialog::Accepted) { | 1947 | if (dlg->exec() == QDialog::Accepted) { |
1946 | // myDoc->recordReset(); | 1948 | // myDoc->recordReset(); |
1947 | cursor.x = 0; | 1949 | cursor.x = 0; |
1948 | cursor.y = dlg->getLine() - 1; | 1950 | cursor.y = dlg->getLine() - 1; |
1949 | myDoc->needPreHighlight(cursor.y); | 1951 | myDoc->needPreHighlight(cursor.y); |
1950 | myViewInternal->updateCursor(cursor); | 1952 | myViewInternal->updateCursor(cursor); |
1951 | myViewInternal->center(); | 1953 | myViewInternal->center(); |
1952 | myViewInternal->updateView(KateView::ufUpdateOnScroll); | 1954 | myViewInternal->updateView(KateView::ufUpdateOnScroll); |
1953 | myDoc->updateViews(this); //uptade all other views except this one | 1955 | myDoc->updateViews(this); //uptade all other views except this one |
1954 | } | 1956 | } |
1957 | qApp->processEvents(); | ||
1955 | delete dlg; | 1958 | delete dlg; |
1956 | } | 1959 | } |
1957 | 1960 | ||
1958 | 1961 | ||
1959 | void KateView::initSearch(SConfig &s, int flags) { | 1962 | void KateView::initSearch(SConfig &s, int flags) { |
1960 | 1963 | ||
1961 | s.flags = flags; | 1964 | s.flags = flags; |
1962 | s.setPattern(myDoc->searchForList.first()); | 1965 | s.setPattern(myDoc->searchForList.first()); |
1963 | 1966 | ||
1964 | if (!(s.flags & KateView::sfFromBeginning)) { | 1967 | if (!(s.flags & KateView::sfFromBeginning)) { |
1965 | // If we are continuing a backward search, make sure we do not get stuck | 1968 | // If we are continuing a backward search, make sure we do not get stuck |
1966 | // at an existing match. | 1969 | // at an existing match. |