GNOME Bugzilla – Bug 749869
Segfault (not infinite loop) on the second search
Last modified: 2015-05-27 19:32:22 UTC
Created attachment 303961 [details] gdb log With gcmd 1.4.6 (not head), the procedure described in bug 748869 i.e. * launch gnome-commander * Go to some non-empty directory * Choose "File"->"Search" * On "Search" dialog, in the text box right of "Path matches regex", type some string (for search), e.g. "mp4" * Type enter key, then search result is shown (like "Found 36 matches"). * Then select the above text box (with mouse left click) and type enter key again. now segfaults. Backtrace attached.
So: * bug 748869 was when search result was found, the second search caused infinite loop, this issue was fixed by resetting default response when search result is found. * And bug 745454 was when search dialog was launched (thus search result is empty), pressing enter key may cause segv. This was fixed by setting focus to pattern_combo widget. * Now with this bug (bug 749869), the backtrace seems very similar with bug 745454 , but now as search result was already found, the focus was explicitly set to data->dialog->priv->result_list (not pattern_combo). With bug 748869 resolved, this issue did not occur on master branch with 5b0b3a469ab426feb596b0edfcc61cde4c0e6e80 (and a7239bd930cc840b59cbe2b1fed0a49301a78473), however on gcmd 1.4.6, this still crashes, even with 7027839f724304afc27528ed35302f838db5b985 and e47883cd16c914158b9d20da67b7b06d8c7265a7. So backporting mime_exec_file() related fix will fix this, however please read below
Created attachment 303962 [details] [review] Proposal patch So this seems because when some matched entry is found, focus is set to result_list entry, not no entry in result_list may be chosen yet. Then the next enter key goes on_list_keypressed(), because the focus is explicitly chosen on result_list, but no entry is chosen, then segfaults on mime_exec_file() as get_focus_file() returns nothing. So I think when some matched entry is found and no entry is chosen is set, setting to the top entry should be applied.
Yes, this is true. Actually, gcmd does not crash on master branch because commit 5b0b3a4 returns NULL on mime_exec_file() if the list of found objects is empty. On branch 1.4.6 this check is not applied. Anyway, I like your patch and will commit it on branch gcmd-1-4.