[gtranslator/dl-integration: 17/18] dl-integration: Initialize pointers on declaration



commit 6ea7207b14b6d8b015ede87e8b1b2b3c2aa429b2
Author: Teja Cetinski <teja cetinski eu>
Date:   Thu Mar 21 17:48:13 2019 +0100

    dl-integration: Initialize pointers on declaration
    
    Initialize pointers as null on declaration; fixes app crash on
    inexistent stats endpoint. Remove unneeded tmp path from flatpak args.

 build-aux/flatpak/org.gnome.Gtranslator.json |  1 -
 src/gtr-dl-teams.c                           | 14 +++++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Gtranslator.json b/build-aux/flatpak/org.gnome.Gtranslator.json
index 516e4950..9c8782f4 100644
--- a/build-aux/flatpak/org.gnome.Gtranslator.json
+++ b/build-aux/flatpak/org.gnome.Gtranslator.json
@@ -14,7 +14,6 @@
         "--socket=x11",
         "--socket=wayland",
         "--filesystem=home",
-        "--filesystem=/tmp",
         "--filesystem=xdg-run/dconf",
         "--filesystem=~/.config/dconf:ro",
         "--talk-name=ca.desrt.dconf",
diff --git a/src/gtr-dl-teams.c b/src/gtr-dl-teams.c
index 2890c620..ff4b9041 100644
--- a/src/gtr-dl-teams.c
+++ b/src/gtr-dl-teams.c
@@ -107,7 +107,7 @@ gtr_dl_teams_parse_teams_json (GObject *object,
                                gpointer user_data)
 {
   g_autoptr(JsonParser) parser = json_parser_new ();
-  g_autoptr(GInputStream) stream;
+  g_autoptr(GInputStream) stream = NULL;
   GError *error = NULL;
   JsonNode *node = NULL;
   JsonArray *array = NULL;
@@ -152,10 +152,10 @@ gtr_dl_teams_load_module_details_json (GtkComboBox *combo,
                                        GtrDlTeams *self)
 {
   GtrDlTeamsPrivate *priv = gtr_dl_teams_get_instance_private (self);
-  g_autoptr(SoupMessage) msg;
-  g_autoptr(SoupSession) session;
+  g_autoptr(SoupMessage) msg = NULL;
+  g_autoptr(SoupSession) session = NULL;
   g_autofree gchar *module_endpoint;
-  g_autoptr(JsonParser) parser;
+  g_autoptr(JsonParser) parser = NULL;
   gint i;
   GError *error = NULL;
   JsonNode *node = NULL;
@@ -254,7 +254,7 @@ gtr_dl_teams_parse_modules_json (GObject *object,
                                  gpointer user_data)
 {
   g_autoptr(JsonParser) parser = json_parser_new ();
-  g_autoptr(GInputStream) stream;
+  g_autoptr(GInputStream) stream = NULL;
        GError *error = NULL;
 
   JsonNode *node = NULL;
@@ -333,8 +333,8 @@ gtr_dl_teams_get_file_info (GtrDlTeams *self)
   GtrDlTeamsPrivate *priv = gtr_dl_teams_get_instance_private (self);
   gchar *stats_endpoint;
   JsonNode *node = NULL;
-  g_autoptr(JsonParser) parser;
-  g_autoptr(JsonObject) object;
+  g_autoptr(JsonParser) parser = NULL;
+  g_autoptr(JsonObject) object = NULL;
   SoupMessage *msg;
   SoupSession *session;
   GError *error = NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]