[nautilus/gnome-3-20] application: protect against having no window
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-20] application: protect against having no window
- Date: Thu, 28 Apr 2016 09:43:48 +0000 (UTC)
commit 74dd46017d3c5a7e8ef18d3f5a5fbb9c4ea1d2a7
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Apr 26 10:32:34 2016 +0200
application: protect against having no window
If nautilus is run with --gapplication-service it has no active window
active.
We were assuming there is always a window active, and therefore nautilus
was crashing if the active window was null.
To fix it add some safe guards.
https://bugzilla.gnome.org/show_bug.cgi?id=765045
src/nautilus-application.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index 24afe97..4bc924d 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -338,7 +338,7 @@ nautilus_application_open_location_full (NautilusApplication *self,
{
NautilusWindowSlot *active_slot;
NautilusWindow *active_window;
- GFile *old_location;
+ GFile *old_location = NULL;
char *old_uri, *new_uri;
gboolean use_same;
@@ -348,11 +348,16 @@ nautilus_application_open_location_full (NautilusApplication *self,
* so what we do is never rely on this on the callers, but would be cool to
* make it work withouth explicitly setting the active window on the callers. */
active_window = NAUTILUS_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (self)));
- active_slot = nautilus_window_get_active_slot (active_window);
+ /* There is no active window if the application is run with
+ * --gapplication-service
+ */
+ if (active_window) {
+ active_slot = nautilus_window_get_active_slot (active_window);
+ /* Just for debug.*/
+ old_location = nautilus_window_slot_get_location (active_slot);
+ }
- /* Just for debug.*/
- old_location = nautilus_window_slot_get_location (active_slot);
/* this happens at startup */
if (old_location == NULL)
old_uri = g_strdup ("(none)");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]