[gimp] app: properly pass the last release version and date to gimp-debug-tool.



commit 5b664ecbec8840b7e2177e9d6d3aefcc225f5651
Author: Jehan <jehan girinstud io>
Date:   Fri Jan 3 20:08:12 2020 +0100

    app: properly pass the last release version and date to gimp-debug-tool.
    
    Previously we were only passing this information on the debug dialog
    when debugging warnings and criticals. Now it will also have the
    information for crashes, hence recommending people to update their GIMP
    instead of reporting bugs on old versions.

 app-tools/gimp-debug-tool.c      | 20 +++++++++++++++-----
 app/errors.c                     | 11 +++++++++--
 app/widgets/gimpcriticaldialog.c |  2 +-
 3 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/app-tools/gimp-debug-tool.c b/app-tools/gimp-debug-tool.c
index d94349bc26..fbce802e5a 100644
--- a/app-tools/gimp-debug-tool.c
+++ b/app-tools/gimp-debug-tool.c
@@ -49,14 +49,17 @@ main (int    argc,
   const gchar *pid;
   const gchar *reason;
   const gchar *message;
-  const gchar *bt_file = NULL;
-  gchar       *trace   = NULL;
+  const gchar *bt_file      = NULL;
+  const gchar *last_version = NULL;
+  const gchar *release_date = NULL;
+  gchar       *trace        = NULL;
   gchar       *error;
   GtkWidget   *dialog;
 
-  if (argc != 6)
+  if (argc != 6 && argc != 8)
     {
-      g_print ("Usage: gimp-debug-tool-2.0 [PROGRAM] [PID] [REASON] [MESSAGE] [BT_FILE]\n");
+      g_print ("Usage: gimp-debug-tool-2.0 [PROGRAM] [PID] [REASON] [MESSAGE] [BT_FILE] "
+               "([LAST_VERSION] [RELEASE_TIMESTAMP])\n");
       exit (EXIT_FAILURE);
     }
 
@@ -73,9 +76,16 @@ main (int    argc,
   if (trace == NULL || strlen (trace) == 0)
     exit (EXIT_FAILURE);
 
+  if (argc == 8)
+    {
+      last_version = argv[6];
+      release_date = argv[7];
+    }
+
   gtk_init (&argc, &argv);
 
-  dialog = gimp_critical_dialog_new (_("GIMP Crash Debug"), NULL, 0);
+  dialog = gimp_critical_dialog_new (_("GIMP Crash Debug"), last_version,
+                                     g_ascii_strtoll (release_date, NULL, 10));
   gimp_critical_dialog_add (dialog, error, trace, TRUE, program,
                             g_ascii_strtoull (pid, NULL, 10));
   g_free (error);
diff --git a/app/errors.c b/app/errors.c
index 10f1f44888..c27bdfbb2a 100644
--- a/app/errors.c
+++ b/app/errors.c
@@ -41,6 +41,8 @@
 #include "core/gimpitem.h"
 #include "core/gimpparamspecs.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "pdb/gimppdb.h"
 
 #include "errors.h"
@@ -361,14 +363,19 @@ gimp_eek (const gchar *reason,
 #else
           const gchar *gimpdebug = LIBEXECDIR "/gimp-debug-tool-" GIMP_TOOL_VERSION;
 #endif
-          gchar *args[7] = { (gchar *) gimpdebug, full_prog_name, NULL,
+          gchar *args[9] = { (gchar *) gimpdebug, full_prog_name, NULL,
                              (gchar *) reason, (gchar *) message,
-                             backtrace_file, NULL };
+                             backtrace_file, the_errors_gimp->config->last_known_release,
+                             NULL, NULL };
           gchar  pid[16];
+          gchar  timestamp[16];
 
           g_snprintf (pid, 16, "%u", (guint) getpid ());
           args[2] = pid;
 
+          g_snprintf (timestamp, 16, "%lu", the_errors_gimp->config->last_release_timestamp);
+          args[7] = timestamp;
+
 #ifndef G_OS_WIN32
           /* On Win32, the trace has already been processed by ExcHnl
            * and is waiting for us in a text file.
diff --git a/app/widgets/gimpcriticaldialog.c b/app/widgets/gimpcriticaldialog.c
index a33e3f35d9..b00a5caf37 100644
--- a/app/widgets/gimpcriticaldialog.c
+++ b/app/widgets/gimpcriticaldialog.c
@@ -569,7 +569,7 @@ gimp_critical_dialog_add (GtkWidget   *dialog,
                       text);
   g_free (text);
 
-  if (is_fatal)
+  if (is_fatal && ! critical->last_version)
     {
       /* Same text as before except that we don't need the last point
        * about saving and restarting since anyway we are crashing and


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