GNOME Bugzilla – Bug 745454
Segmentation fault after find files.
Last modified: 2015-05-25 19:01:07 UTC
1. Press F9. 2. Press "Enter" 3. Get "Segmentation fault." Run gnome-commander under gdb and get: Program received signal SIGSEGV, Segmentation fault. GnomeCmdFileList::key_pressed (this=0x9e6570, event=event@entry=0xc7d600) at gnome-cmd-file-list.cc:2388 2388 return mime_exec_file (get_focused_file()); I think that this is due to the fact that not more than one selected file found, the button "Go To" is not active, but when you press the "Enter" does not check for file selection, so get_focused_file return null.
Thanks for taking the time to report this. Could you provide a full stracktrace? Without a stack trace from the crash it's very hard to determine what caused it. Can you get us a stack trace? Please see https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces for more information on how to do so. When pasting a stack trace in this bug report, please reset the status of this bug report from NEEDINFO to its previous status. Thanks in advance!
Program received signal SIGSEGV, Segmentation fault. GnomeCmdFileList::key_pressed (this=0x9e6570, event=event@entry=0xc44eb0) at gnome-cmd-file-list.cc:2388 2388 return mime_exec_file (get_focused_file()); (gdb) bt
+ Trace 234761
I want to offer the option: inline gboolean mime_exec_file (GnomeCmdFile *f) { if (f != NULL && f->info->type == GNOME_VFS_FILE_TYPE_REGULAR) { mime_exec_single (f); return TRUE; } return FALSE; }
Hi Pavel, thank you very much for your bug report and the stack trace you provided. Unfortunately I can not reproduce the crash you described by steps 1-3 above with the current development version. Can you tell what exact GCMD-version you are using? Thanks in advance, Uwe
GNOME gnome-commander 1.4.6 From git clone -b gcmd-1-4 git://git.gnome.org/gnome-commander and git clone git://git.gnome.org/gnome-commander After find files immediately press key "enter" without selecting any file in the list.
(In reply to Pavel Elagin from comment #5) > After find files immediately press key "enter" without selecting any file in > the list. Meanwhile I could reproduce this behavior, too. In my case GCMD crashes only, when the list of found files is empty and I press enter immediately after the search. Thank you for your offered solution in comment #3. I will have a look into it, as soon as possible.
More Info: I tested your code. Unfortunately, GCMD still crashes. But I have to admit that I trigger the crash slightly differently: 1. Press F9 2. Press "Enter" -> No crash! 3. Only when nothing is found: -> Pressing "Enter" again leads to the crash My backtrace seems to be totally broken in this case, which is a hint to some hidden memory leaks. Your code comment above is a reasonable modification of mime_exec_file. I applied it to the master branch in a modified form. Can you verify that the crash does not occur in your case then pulling the master branch?
*** This bug has been marked as a duplicate of bug 748869 ***
Created attachment 303636 [details] gdb log on gcmd 1.4.6 Hello. I've met this bug with gcmd 1.4.6 and somehow managed to find how to reproduce this. With gcmd 1.4.6: * Select "File"->"Search" * On "Search..." dialog, - write "*.pdf" on the right text box of "Path matches regex:" - choose "Current directory only" * Click "Find", returning "Found 10 matches", for example. * Destroy "Search..." dialog with cross (x) button (at the top-right of the window) * Again Select "File"->"Search" * Just type Enter key Then gcmd 1.4.6 crashes with the attached gdb log. Backporting 5b0b3a469ab426feb596b0edfcc61cde4c0e6e80 fixes this issue. Would you backport the above commit to gcmd-1-4 branch?
Hi, commit 5b0b3a4 was only committed in the master branch, not in gcmd-1-4 branch. I committed this change only in master as the crash of gcmd is not fixed with this commit. But now, when looking again on 5b0b3a4, I think that I made a slight mistake there, which has to be fixed. Now, it should be: diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc index d46ed16..8f689a2 100644 --- a/src/gnome-cmd-file-list.cc +++ b/src/gnome-cmd-file-list.cc @@ -1177,9 +1177,10 @@ inline gboolean mime_exec_file (GnomeCmdFile *f) if (f->info->type == GNOME_VFS_FILE_TYPE_REGULAR) { mime_exec_single (f); + return TRUE; } + return FALSE; - return TRUE; } What do you think? Nevertheless, I think you are right and the bug has nothing to do with mime_exec_file(). I guess, there is again a problem with memory allocation.
Created attachment 303725 [details] [review] Proposal patch So the problem seem to be that sometimes GnomeCmdSearchDialog priv->result_list receives "key-press-event" because focus is not set explicitly. I wrote a proposal patch to set focus explicitly when doing search. (Anyway modifying mime_exec_file() should be no problem)
The above patch is for gcmd-1-4 branch.
And again a clean patch from Mamoru. Thank you very much. I checked it and it does its job very well! The fix will go into the next bugfix release of gcmd.