mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-01 18:50:16 +03:00
* Fixed the crash in src/tools/ecode/globalsearchcontroller.cpp:603.
Probable reproduction: 1. Open global search. 2. Enter a search term. 3. Start “replace in files” with Mod+R. 4. Before the asynchronous search finishes, switch to document search. 5. Immediately reopen normal global search. The replace tree becomes active as soon as the search starts, but its model is only assigned when the asynchronous result arrives. Reopening normal global search tried to reuse that still-null model and called rowCount() on it. The loader is also closed during this transition, explaining the SceneNode::checkClose() trace from another timing of the same sequence. The fix: - Only transfers replace results when the replace model exists. - Adds a defensive null check to updateGlobalSearchBarResults().
This commit is contained in:
@@ -601,10 +601,13 @@ void GlobalSearchController::showGlobalSearch( bool searchReplace,
|
||||
mGlobalSearchLayout->findByClass( "replace_box" )->setVisible( searchReplace );
|
||||
mGlobalSearchBarLayout->find( "buffer_only_mode" )->setVisible( searchReplace );
|
||||
if ( wasReplaceTree ) {
|
||||
updateGlobalSearchBarResults( mGlobalSearchTreeReplace->getSearchStr(),
|
||||
std::static_pointer_cast<ProjectSearch::ResultModel>(
|
||||
mGlobalSearchTreeReplace->getModelShared() ),
|
||||
searchReplace, escapeSequenceChk->isChecked() );
|
||||
// The replace tree has no model until its asynchronous search completes.
|
||||
auto model = std::static_pointer_cast<ProjectSearch::ResultModel>(
|
||||
mGlobalSearchTreeReplace->getModelShared() );
|
||||
if ( model ) {
|
||||
updateGlobalSearchBarResults( mGlobalSearchTreeReplace->getSearchStr(), model,
|
||||
searchReplace, escapeSequenceChk->isChecked() );
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( mGlobalSearchWhereInput && pathFilters )
|
||||
@@ -697,6 +700,8 @@ void GlobalSearchController::toggleGlobalSearchBar() {
|
||||
void GlobalSearchController::updateGlobalSearchBarResults(
|
||||
const std::string& search, std::shared_ptr<ProjectSearch::ResultModel> model,
|
||||
bool searchReplace, bool isEscaped ) {
|
||||
if ( !model )
|
||||
return;
|
||||
updateGlobalSearchBar();
|
||||
mGlobalSearchTree->hExtLanguageType = mApp->getProjectConfig().hExtLanguageType;
|
||||
mGlobalSearchTree->setSearchStr( search );
|
||||
|
||||
Reference in New Issue
Block a user