]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Fix progress bar during libdivecomputer imports
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 22 Sep 2011 23:38:24 +0000 (16:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 22 Sep 2011 23:38:24 +0000 (16:38 -0700)
As reported by Mauro Dreissig, the progress bar doesn't work and causes
a SIGSEGV due to a missing allocation.  The code broke when Dirk
separated out the GUI from the core code, and I hadn't tried
divecomputer downloads since.

Reported-by: Mauro Dreissig <mukadr@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
gtk-gui.c
libdivecomputer.c
libdivecomputer.h

index 3994387acdf5f42f632451152e48b42671c4dde0..754a77772e9ac70e7bc8ee2aa72b62f3ca012504 100644 (file)
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -616,8 +616,8 @@ void import_dialog(GtkWidget *w, gpointer data)
 
        hbox = gtk_hbox_new(FALSE, 6);
        gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, TRUE, 3);
-       devicedata.progress->bar = gtk_progress_bar_new();
-       gtk_container_add(GTK_CONTAINER(hbox), devicedata.progress->bar);
+       devicedata.progress.bar = gtk_progress_bar_new();
+       gtk_container_add(GTK_CONTAINER(hbox), devicedata.progress.bar);
 
        gtk_widget_show_all(dialog);
        result = gtk_dialog_run(GTK_DIALOG(dialog));
index cf8b048c9e79e62ea63f30bc04a364ce3ce59855..f645bff1495eed865f37f8991d16f2868e270e49 100644 (file)
@@ -369,7 +369,7 @@ static void event_cb(device_t *device, device_event_t event, const void *data, v
                printf("Event: waiting for user action\n");
                break;
        case DEVICE_EVENT_PROGRESS:
-               update_progressbar(devdata->progress,
+               update_progressbar(&devdata->progress,
                        (double) progress->current / (double) progress->maximum);
                break;
        case DEVICE_EVENT_DEVINFO:
index 205f28e7c2dea38a12f16cbe1d8b9adad3ce7628..abb09e2c4b7fd9fc22b503de5b2c3f954fd4b3ab 100644 (file)
@@ -22,7 +22,7 @@
 typedef struct device_data_t {
        device_type_t type;
        const char *name, *devname;
-       progressbar_t *progress;
+       progressbar_t progress;
        device_devinfo_t devinfo;
        device_clock_t clock;
 } device_data_t;