gfio: fix crash when pushing 'start job' and no client connected
[fio.git] / gfio.c
diff --git a/gfio.c b/gfio.c
index 88d67588d7affe5135083296f53d3341d2af532e..51bac2aa8e864577a5aa35f33aebebdccf1e74e9 100644 (file)
--- a/gfio.c
+++ b/gfio.c
@@ -1738,8 +1738,8 @@ static void start_job_clicked(__attribute__((unused)) GtkWidget *widget,
        struct gui_entry *ge = data;
        struct gfio_client *gc = ge->client;
 
-       gtk_widget_set_sensitive(ge->button[START_JOB_BUTTON], 0);
-       fio_start_client(gc->client);
+       if (gc)
+               fio_start_client(gc->client);
 }
 
 static void file_open(GtkWidget *w, gpointer data);
@@ -1753,7 +1753,7 @@ static void connect_clicked(GtkWidget *widget, gpointer data)
                int ret;
 
                if (!ge->nr_job_files)
-                       file_open(widget, data);
+                       file_open(widget, ge->ui);
                if (!ge->nr_job_files)
                        return;
 
@@ -2065,7 +2065,7 @@ static void file_new(GtkWidget *w, gpointer data)
  * Return the 'ge' corresponding to the tab. If the active tab is the
  * main tab, open a new tab.
  */
-static struct gui_entry *get_ge_from_page(unsigned int cur_page)
+static struct gui_entry *get_ge_from_page(gint cur_page)
 {
        struct flist_head *entry;
        struct gui_entry *ge;
@@ -2476,14 +2476,16 @@ static const gchar *ui_string = " \
                                <separator name=\"Separator2\"/> \
                                <menuitem name=\"Preferences\" action=\"Preferences\" /> \
                                <separator name=\"Separator3\"/> \
+                               <placeholder name=\"FileRecentFiles\"/> \
+                               <separator name=\"Separator4\"/> \
                                <menuitem name=\"Quit\" action=\"Quit\" /> \
                        </menu> \
                        <menu name=\"JobMenu\" action=\"JobMenuAction\"> \
                                <menuitem name=\"Connect\" action=\"ConnectJob\" /> \
-                               <separator name=\"Separator4\"/> \
+                               <separator name=\"Separator5\"/> \
                                <menuitem name=\"Edit job\" action=\"EditJob\" /> \
                                <menuitem name=\"Send job\" action=\"SendJob\" /> \
-                               <separator name=\"Separator5\"/> \
+                               <separator name=\"Separator6\"/> \
                                <menuitem name=\"Start job\" action=\"StartJob\" /> \
                        </menu>\
                        <menu name=\"ViewMenu\" action=\"ViewMenuAction\"> \