From 9adbd054e4de88de262d7fa8243ccd73789e2bfc Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 5 Jan 2014 01:26:41 +0100 Subject: [PATCH] Do not resetSearch if we're closing down It's useless as it will be reset anyway on the close down procedure and it will cause a crash if you are unlucky. Reason: * In the document observers qset pageview comes before * We are closing and notifySetup with an empty vector * pageview empties its vector in notifySetip * part sees the notifySetup and resets the search * resetting the search calls another notifySetup with the non empty page vector that will be deleted asap when we go back to the first notifySetup There are another billion ways to fix this: * Don't allow nested notifySetup * Clear the running searches before sending the first notifySetup * Empty the pagesVector before sending the first notifySetup * etc But i feel this is the less invasive one (even if it may not be the most technically correct) BUGS: 329582 FIXED-IN: 4.12.1 --- core/document.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/document.cpp b/core/document.cpp index 10cd238c0..5264754ec 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -3400,6 +3400,10 @@ void Document::continueSearch( int searchID, SearchType type ) void Document::resetSearch( int searchID ) { + // if we are closing down, don't bother doing anything + if ( !d->m_generator ) + return; + // check if searchID is present in runningSearches QMap< int, RunningSearch * >::iterator searchIt = d->m_searches.find( searchID ); if ( searchIt == d->m_searches.end() )