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.
This commit is contained in:
Jehan 2020-01-03 20:08:12 +01:00
parent 2cd765c000
commit 5b664ecbec
3 changed files with 25 additions and 8 deletions

View File

@ -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);

View File

@ -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.

View File

@ -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