aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-15 22:42:11 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-15 22:42:11 +0200
commit899f2c738e7117fd5c15e78c9c530241287674e9 (patch)
tree2e2c93c3268056c0152de06a625c9b229533be2f
parent313fcd50a2d8a8f3e854e0c6004cd52121d3ccd8 (diff)
downloadgnunet-gtk-899f2c738e7117fd5c15e78c9c530241287674e9.tar.gz
gnunet-gtk-899f2c738e7117fd5c15e78c9c530241287674e9.zip
fix namestore gtk segv on exit
-rw-r--r--src/namestore/gnunet-namestore-gtk.c52
1 files changed, 31 insertions, 21 deletions
diff --git a/src/namestore/gnunet-namestore-gtk.c b/src/namestore/gnunet-namestore-gtk.c
index e2150c1c..94dd8d97 100644
--- a/src/namestore/gnunet-namestore-gtk.c
+++ b/src/namestore/gnunet-namestore-gtk.c
@@ -476,7 +476,7 @@ static const struct GNUNET_CONFIGURATION_Handle *cfg;
476/** 476/**
477 * Ongoing identity operation. 477 * Ongoing identity operation.
478 */ 478 */
479struct GNUNET_IDENTITY_Operation *iop; 479static struct GNUNET_IDENTITY_Operation *iop;
480 480
481/** 481/**
482 * Global return value (for success/failure of gnunet-setup). 482 * Global return value (for success/failure of gnunet-setup).
@@ -495,7 +495,8 @@ get_object (const char *name)
495{ 495{
496 if (NULL == ml) 496 if (NULL == ml)
497 return NULL; 497 return NULL;
498 return GNUNET_GTK_main_loop_get_object (ml, name); 498 return GNUNET_GTK_main_loop_get_object (ml,
499 name);
499} 500}
500 501
501 502
@@ -523,7 +524,8 @@ create_qrcode (unsigned int scale)
523 unsigned int size; 524 unsigned int size;
524 char *upper; 525 char *upper;
525 526
526 qri = QRinput_new2 (0, QR_ECLEVEL_M); 527 qri = QRinput_new2 (0,
528 QR_ECLEVEL_M);
527 if (NULL == qri) 529 if (NULL == qri)
528 { 530 {
529 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, 531 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
@@ -577,7 +579,8 @@ create_qrcode (unsigned int scale)
577 size = qrc->width * scale; 579 size = qrc->width * scale;
578 size += 8 - (size % 8); 580 size += 8 - (size % 8);
579 pb = gdk_pixbuf_new_from_file_at_size (fn, 581 pb = gdk_pixbuf_new_from_file_at_size (fn,
580 size, size, 582 size,
583 size,
581 NULL); 584 NULL);
582 GNUNET_free (fn); 585 GNUNET_free (fn);
583 if (NULL == pb) 586 if (NULL == pb)
@@ -659,7 +662,8 @@ gnunet_namestore_gtk_qr_save_as_dialog_response_cb (GtkDialog *dialog,
659 pb = create_qrcode (8); 662 pb = create_qrcode (8);
660 if (NULL == pb) 663 if (NULL == pb)
661 { 664 {
662 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Failed to initialize QR-code pixbuf")); 665 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
666 _("Failed to initialize QR-code pixbuf"));
663 return; 667 return;
664 } 668 }
665 gdk_pixbuf_save (pb, 669 gdk_pixbuf_save (pb,
@@ -1841,8 +1845,11 @@ gnunet_namestore_gtk_popup_edit_button_activate_cb (GtkWidget *widget,
1841 GNUNET_break (0); 1845 GNUNET_break (0);
1842 return; 1846 return;
1843 } 1847 }
1844 GNUNET_CRYPTO_hash (n_name, strlen (n_name), &name_hash); 1848 GNUNET_CRYPTO_hash (n_name,
1845 ri = GNUNET_CONTAINER_multihashmap_get (n2r, &name_hash); 1849 strlen (n_name),
1850 &name_hash);
1851 ri = GNUNET_CONTAINER_multihashmap_get (n2r,
1852 &name_hash);
1846 if ( (NULL == ri) || 1853 if ( (NULL == ri) ||
1847 (off >= ri->rd_count) ) 1854 (off >= ri->rd_count) )
1848 { 1855 {
@@ -2301,6 +2308,7 @@ gnunet_namestore_gtk_public_key_copy_button_clicked_cb (GtkButton *button,
2301static void 2308static void
2302zone_sync_proc (void *cls) 2309zone_sync_proc (void *cls)
2303{ 2310{
2311 (void) cls;
2304 gtk_tree_view_set_model (tv, 2312 gtk_tree_view_set_model (tv,
2305 tm); 2313 tm);
2306#if HAVE_QRENCODE_H 2314#if HAVE_QRENCODE_H
@@ -2328,6 +2336,7 @@ zone_sync_proc (void *cls)
2328static void 2336static void
2329zone_iteration_error (void *cls) 2337zone_iteration_error (void *cls)
2330{ 2338{
2339 (void) cls;
2331 clear_zone_view (); 2340 clear_zone_view ();
2332#if HAVE_QRENCODE_H 2341#if HAVE_QRENCODE_H
2333 setup_qrcode (); 2342 setup_qrcode ();
@@ -2339,9 +2348,6 @@ zone_iteration_error (void *cls)
2339 gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button"))); 2348 gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button")));
2340 gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator"))); 2349 gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator")));
2341#endif 2350#endif
2342 gtk_widget_show (GTK_WIDGET (status_label));
2343 gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_scrolledwindow")));
2344 gtk_widget_hide (GTK_WIDGET (zone_combo_box));
2345} 2351}
2346 2352
2347 2353
@@ -2408,6 +2414,7 @@ zone_iteration_proc (void *cls,
2408 GtkTreeIter sel_iter; 2414 GtkTreeIter sel_iter;
2409 GtkTreePath *sel_path; 2415 GtkTreePath *sel_path;
2410 2416
2417 (void) cls;
2411 GNUNET_NAMESTORE_zone_monitor_next (zmon, 2418 GNUNET_NAMESTORE_zone_monitor_next (zmon,
2412 1); 2419 1);
2413 if ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) && 2420 if ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) &&
@@ -2429,7 +2436,8 @@ zone_iteration_proc (void *cls,
2429 if (gtk_tree_selection_get_selected (sel, 2436 if (gtk_tree_selection_get_selected (sel,
2430 NULL, 2437 NULL,
2431 &sel_iter)) 2438 &sel_iter))
2432 sel_path = gtk_tree_model_get_path (tm, &sel_iter); 2439 sel_path = gtk_tree_model_get_path (tm,
2440 &sel_iter);
2433 else 2441 else
2434 sel_path = NULL; 2442 sel_path = NULL;
2435 ri = GNUNET_CONTAINER_multihashmap_get (n2r, 2443 ri = GNUNET_CONTAINER_multihashmap_get (n2r,
@@ -2640,6 +2648,7 @@ load_zone (const char *name,
2640#if HAVE_QRENCODE_H 2648#if HAVE_QRENCODE_H
2641 setup_qrcode (); 2649 setup_qrcode ();
2642#endif 2650#endif
2651 GNUNET_assert (NULL != n2r);
2643 zmon = GNUNET_NAMESTORE_zone_monitor_start (cfg, 2652 zmon = GNUNET_NAMESTORE_zone_monitor_start (cfg,
2644 pkey, 2653 pkey,
2645 GNUNET_YES, 2654 GNUNET_YES,
@@ -2741,11 +2750,6 @@ cleanup_task (void *cls)
2741 GNUNET_GTK_main_loop_quit (ml); 2750 GNUNET_GTK_main_loop_quit (ml);
2742 gtk_widget_show (GTK_WIDGET (status_label)); 2751 gtk_widget_show (GTK_WIDGET (status_label));
2743 gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_scrolledwindow"))); 2752 gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_scrolledwindow")));
2744 if (NULL != zmon)
2745 {
2746 GNUNET_NAMESTORE_zone_monitor_stop (zmon);
2747 zmon = NULL;
2748 }
2749 while (NULL != (oc = oc_head)) 2753 while (NULL != (oc = oc_head))
2750 { 2754 {
2751 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2755 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -2770,11 +2774,6 @@ cleanup_task (void *cls)
2770 GNUNET_free (moc); 2774 GNUNET_free (moc);
2771 } 2775 }
2772 gtk_tree_store_clear (ts); 2776 gtk_tree_store_clear (ts);
2773 if (NULL != namestore)
2774 {
2775 GNUNET_NAMESTORE_disconnect (namestore);
2776 namestore = NULL;
2777 }
2778 if (NULL != pkey) 2777 if (NULL != pkey)
2779 { 2778 {
2780 GNUNET_free (pkey); 2779 GNUNET_free (pkey);
@@ -2795,6 +2794,16 @@ cleanup_task (void *cls)
2795 GNUNET_IDENTITY_disconnect (identity); 2794 GNUNET_IDENTITY_disconnect (identity);
2796 identity = NULL; 2795 identity = NULL;
2797 } 2796 }
2797 if (NULL != zmon)
2798 {
2799 GNUNET_NAMESTORE_zone_monitor_stop (zmon);
2800 zmon = NULL;
2801 }
2802 if (NULL != namestore)
2803 {
2804 GNUNET_NAMESTORE_disconnect (namestore);
2805 namestore = NULL;
2806 }
2798 if (NULL != n2r) 2807 if (NULL != n2r)
2799 { 2808 {
2800 GNUNET_CONTAINER_multihashmap_iterate (n2r, 2809 GNUNET_CONTAINER_multihashmap_iterate (n2r,
@@ -2803,6 +2812,7 @@ cleanup_task (void *cls)
2803 GNUNET_CONTAINER_multihashmap_destroy (n2r); 2812 GNUNET_CONTAINER_multihashmap_destroy (n2r);
2804 n2r = NULL; 2813 n2r = NULL;
2805 } 2814 }
2815 GNUNET_assert (NULL == zmon);
2806 while (NULL != (tld = tld_head)) 2816 while (NULL != (tld = tld_head))
2807 { 2817 {
2808 GNUNET_CONTAINER_DLL_remove (tld_head, 2818 GNUNET_CONTAINER_DLL_remove (tld_head,