Skip to content
Commit 9b82f864 authored by Oleg Solovyov's avatar Oleg Solovyov 🐴
Browse files

Fix stack overflow

We get an infinite recursion when we perform search with no files found.
See below:

void FileSearchTab::performSearch()
{
    if (m_searchFileListView->files().isEmpty()) { // <= assume true
        addFilesToSearch(doScanRecursive(QDir(Project::instance()->poDir()))); // <= arg is an empty list
	if (m_searchFileListView->files().isEmpty()) // <= unreachable, see below
	[...]
}

void FileSearchTab::addFilesToSearch(const QStringList& files)
{
    m_searchFileListView->addFiles(files); // <= files.isEmpty() == true
    performSearch(); // <= m_searchFileListView->files().isEmpty() == true
}

Steps to reproduce:
1) Project -> Create software translation project -> Save
2) RMB -> Search in files
3) Wait ~1 minute until crash
parent 281f0ada
Pipeline #106429 passed with stage
in 4 minutes and 32 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment