After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755711 - Shift + control crash
Shift + control crash
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Keyboardability
3.16.x
Other Linux
: High critical
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 765527 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2015-09-28 03:55 UTC by Jordan Christiansen
Modified: 2016-09-02 19:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix shift+control+down seg fault on a folder (3.51 KB, patch)
2016-05-05 12:19 UTC, Alexandru Pandelea
none Details | Review
mime-actions: Fix shift+control+down seg fault on a folder (3.26 KB, patch)
2016-05-09 14:00 UTC, Alexandru Pandelea
none Details | Review
mime-actions: Fix shift+control+down seg fault on a folder (3.95 KB, patch)
2016-05-10 10:08 UTC, Alexandru Pandelea
none Details | Review
mime-actions: Fix shift+control+down seg fault on a folder (3.88 KB, patch)
2016-05-13 10:06 UTC, Alexandru Pandelea
none Details | Review
mime-actions: Fix flags in activate_files (1.33 KB, patch)
2016-05-13 10:12 UTC, Alexandru Pandelea
accepted-commit_now Details | Review
mime-actions: Fix shift+control+down seg fault on a folder (3.99 KB, patch)
2016-09-02 10:07 UTC, Alexandru Pandelea
committed Details | Review

Description Jordan Christiansen 2015-09-28 03:55:01 UTC
Steps to reproduce:
1. Select a file or folder in Nautilus.
2. Hold shift and control.
3. With those buttons still held down, press the down arrow key.

Result:
Nautilus terminates with a SIGABRT.
Comment 1 Ernestas Kulik 2016-04-27 08:35:56 UTC
*** Bug 765527 has been marked as a duplicate of this bug. ***
Comment 2 Ernestas Kulik 2016-04-27 17:58:13 UTC
It works fine for me with files. But with folders it crashes.

I think it’s related to https://git.gnome.org/browse/nautilus/tree/src/nautilus-mime-actions.c#n1666
Comment 3 Carlos Soriano 2016-04-28 08:42:03 UTC
Thanks for taking the time to report this.
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!
Comment 4 Alexandru Pandelea 2016-05-05 12:19:28 UTC
Created attachment 327344 [details] [review]
Fix shift+control+down seg fault on a folder

Using this shortcut on one or more folders caused segmentation
fault.

In order to solve this, it was added an extra flag to the function
that activates the files, NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW.
Also, to make sure that only the window from which the shortcut was
launched is closed, the flag NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND
is set only for the first call of nautilus_application_open_location_full.
Comment 5 Alexandru Pandelea 2016-05-09 14:00:39 UTC
Created attachment 327520 [details] [review]
mime-actions: Fix shift+control+down seg fault on a folder

Using this shortcut on one or more folders caused segmentation fault.

In order to solve this, if there is a directory that needs to be activated, the
NEW_WINDOW flag is set, so that the initial window will be closed and a new one
will be created. After a new window is created, the CLOSE_BEHIND flag is disabled,
so that the window will not be closed. The flags NEW_TAB and DONT_MAKE_ACTIVE
are also set there, in order for new tabs to open in the newly created window.
Comment 6 Alexandru Pandelea 2016-05-10 10:08:59 UTC
Created attachment 327568 [details] [review]
mime-actions: Fix shift+control+down seg fault on a folder

Using this shortcut on one or more folders caused segmentation fault.

In order to solve this, if there is a directory that needs to be activated, the
NEW_WINDOW flag is set, so that the initial window will be closed and a new one
will be created. After a new window is created, the CLOSE_BEHIND flag is disabled,
so that the window will not be closed. The flags NEW_TAB and DONT_MAKE_ACTIVE
are also set there(unless we want all directories opened in new windows), in order
for new tabs to open in the newly created window.
Comment 7 Carlos Soriano 2016-05-11 08:53:50 UTC
Review of attachment 327568 [details] [review]:

Starts looking good! Here some review:

::: src/nautilus-mime-actions.c
@@ +1520,3 @@
 	gint num_unhandled;
 	gint num_files;
+	gboolean open_files, closed_window;

One var per line

@@ +1639,3 @@
+			{
+				flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
+				flags |= NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE;

I would let this flag for the callers. We are not sure what the caller wants, for example, when opening from the sidebar.
Any reason you added this here instead than on the caller?

Also, I can see that this flag start looking like a bad decision on my part, and we should probably do the opossite, "make_active". But let's leave this for another patch.

@@ +1650,3 @@
+		/* if we want to close the window and activate a single directory, then we will need
+		 * the NEW_WINDOW flag set */
+		if (count == 1 && (parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)

the count == 1 is pointless here, isn't it?

@@ +1689,3 @@
+			/* close only the window from which the action was launched and then open
+			 * tabs/windows (depending on parameters->flags) */
+			if (count >= 1 && !closed_window &&

count >= 1 is pointless... we don't call this with no files to activate... and in case we want to guard against this, we should do it at the start of the function.

@@ +1700,3 @@
+
+					flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
+					flags |= NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE;

The same, we don't know about this.
What is the result you want to achieve?

@@ +1711,3 @@
+
+		if (closed_window)
+			flags |= NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;

This is done previously with the flags &= (~NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND); no?
Comment 8 Alexandru Pandelea 2016-05-13 09:52:21 UTC
setting the flags NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB and NAUTILUS_WINDOW_OPEN_FLAG_DONT_MAKE_ACTIVE together creates the problem that if a user wants to open a new tab and make it active, that won't be possible.
Comment 9 Alexandru Pandelea 2016-05-13 10:06:19 UTC
Created attachment 327770 [details] [review]
mime-actions: Fix shift+control+down seg fault on a folder

Using this shortcut on one or more folders caused segmentation fault.

In order to solve this, if there is a directory that needs to be activated, the
NEW_WINDOW flag is set, so that the initial window will be closed and a new one
will be created. After a new window is created, the CLOSE_BEHIND flag is disabled,
so that the window will not be closed. The flags NEW_TAB and DONT_MAKE_ACTIVE
are also set there(unless we want all directories opened in new windows), in order
for new tabs to open in the newly created window.
Comment 10 Alexandru Pandelea 2016-05-13 10:12:58 UTC
Created attachment 327772 [details] [review]
mime-actions: Fix flags in activate_files

The problem is that if activate_files is called in order to activate
a folder in a new tab and that folder should be active, that is not
possible due to the fact that NEW_TAB and DONT_MAKE_ACTIVE were set
together in the function activate_files.`

We shouldn't set the DONT_MAKE_ACTIVE flag in activate_files and
leave that flag to be set by the caller.
Comment 11 Carlos Soriano 2016-05-27 12:52:06 UTC
Review of attachment 327770 [details] [review]:

Looks good except some style nitpicks, thanks!

::: src/nautilus-mime-actions.c
@@ +1635,3 @@
+			/* if CLOSE_BEHIND is set and have a directory to be activated, we will first have 
+			 * to open a new window and after that we can open the rest of files in tabs */
+			if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)

if () { when the else more than two lines

@@ +1637,3 @@
+			if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)
+				flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW;
+			else

else {

@@ +1647,3 @@
 		}
 	}
+	else

else {

@@ +1690,3 @@
+			/* close only the window from which the action was launched and then open
+			 * tabs/windows (depending on parameters->flags) */
+			if (!closed_window && (flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0)

if {

@@ +1696,3 @@
+				/* if NEW_WINDOW is set, we want all files in new windows, not in tabs */
+				if ((parameters->flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0)
+				{

if {
Comment 12 Carlos Soriano 2016-05-27 12:52:59 UTC
Review of attachment 327772 [details] [review]:

LGTM
Comment 13 Alexandru Pandelea 2016-09-02 10:07:59 UTC
Created attachment 334630 [details] [review]
mime-actions: Fix shift+control+down seg fault on a folder

Using this shortcut on one or more folders causes segmentation fault.

In order to solve this, if there is a directory that needs to be
activated, the NEW_WINDOW flag is set, so that the initial window will
be closed and a new one will be created. After a new window is created,
the CLOSE_BEHIND flag is disabled,so that the window will not be closed.
The flags NEW_TAB is also set there(unless we want all directories
opened in new windows), in order for new tabs to open in the newly
created window.
Comment 14 Carlos Soriano 2016-09-02 11:55:08 UTC
Review of attachment 334630 [details] [review]:

oh we forgot to commit this one, yeah looks good, thanks for updating to the latest code style!
Comment 15 Alexandru Pandelea 2016-09-02 19:09:26 UTC
Attachment 334630 [details] pushed as 5815ba1 - mime-actions: Fix shift+control+down seg fault on a folder