[easytag/wip/musicbrainz-support-merge: 48/75] Bug Fixed: pressing close when searching will give a crash



commit 1efd47ab53718a1867bf602e6cd0e8183cbb565d
Author: Abhinav <abhijangda hotmail com>
Date:   Sat Aug 16 12:25:15 2014 +0530

    Bug Fixed: pressing close when searching will give a crash
    
    Perform checks in search callbacks before displaying downloaded data

 src/mb_search.h          |    4 ++--
 src/musicbrainz_dialog.c |   23 ++++++++++++++---------
 2 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/src/mb_search.h b/src/mb_search.h
index 62c420a..795375f 100755
--- a/src/mb_search.h
+++ b/src/mb_search.h
@@ -33,8 +33,8 @@
  ****************/
 
 #define NAME_MAX_SIZE 256
-#define SEARCH_LIMIT_STR "5"
-#define SEARCH_LIMIT_INT 5
+#define SEARCH_LIMIT_INT 10
+#define SEARCH_LIMIT_STR "10"
 
 GCancellable *mb5_search_cancellable;
 
diff --git a/src/musicbrainz_dialog.c b/src/musicbrainz_dialog.c
index 28c164c..c697636 100755
--- a/src/musicbrainz_dialog.c
+++ b/src/musicbrainz_dialog.c
@@ -447,8 +447,6 @@ manual_search_callback (GObject *source, GAsyncResult *res,
     ManualSearchThreadData *thread_data;
 
     simple_async = G_SIMPLE_ASYNC_RESULT (res);
-    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
-    priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     thread_data = (ManualSearchThreadData *)user_data;
 
     if (!g_simple_async_result_get_op_res_gboolean (simple_async))
@@ -461,6 +459,8 @@ manual_search_callback (GObject *source, GAsyncResult *res,
         return;
     }
 
+    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+    priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     et_mb_entity_view_clear_all (ET_MB_ENTITY_VIEW (priv->entityView));
     free_mb_tree (&priv->mb_tree_root);
     priv->mb_tree_root = thread_data->node;
@@ -924,8 +924,6 @@ selected_find_callback (GObject *source, GAsyncResult *res,
     EtMusicBrainzDialog *dlg;
     SelectedFindThreadData  *thread_data;
 
-    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
-    mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     thread_data = user_data;
 
     if (!g_simple_async_result_get_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (res)))
@@ -939,6 +937,8 @@ selected_find_callback (GObject *source, GAsyncResult *res,
         return;
     }
 
+    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+    mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     free_mb_tree (&mb_dialog_priv->mb_tree_root);
     mb_dialog_priv->mb_tree_root = thread_data->node;
     et_mb_entity_view_clear_all (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
@@ -1226,9 +1226,7 @@ discid_search_callback (GObject *source, GAsyncResult *res,
     DiscIDSearchThreadData *thread_data;
 
     thread_data = user_data;
-    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
-    mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
-
+    
     if (!g_simple_async_result_get_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (res)))
     {
         g_object_unref (res);
@@ -1237,6 +1235,8 @@ discid_search_callback (GObject *source, GAsyncResult *res,
         return;
     }
 
+    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+    mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     free_mb_tree (&mb_dialog_priv->mb_tree_root);
     mb_dialog_priv->mb_tree_root = thread_data->node;
     et_mb_entity_view_clear_all (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
@@ -1381,8 +1381,6 @@ freedbid_search_callback (GObject *source, GAsyncResult *res,
     EtMusicBrainzDialog *dlg;
     FreeDBIDSearchThreadData *thread_data;
 
-    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
-    mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     thread_data = user_data;
 
     if (!g_simple_async_result_get_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (res)))
@@ -1395,6 +1393,8 @@ freedbid_search_callback (GObject *source, GAsyncResult *res,
         return;
     }
 
+    dlg = ET_MUSICBRAINZ_DIALOG (mbDialog);
+    mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (dlg);
     free_mb_tree (&mb_dialog_priv->mb_tree_root);
     mb_dialog_priv->mb_tree_root = thread_data->node;
     et_mb_entity_view_clear_all (ET_MB_ENTITY_VIEW (mb_dialog_priv->entityView));
@@ -2057,6 +2057,11 @@ et_music_brainz_dialog_stop_set_sensitive (gboolean sensitive)
 {
     EtMusicBrainzDialogPrivate *mb_dialog_priv;
 
+    if (!IS_ET_MUSICBRAINZ_DIALOG (mbDialog))
+    {
+        return;
+    }
+
     mb_dialog_priv = ET_MUSICBRAINZ_DIALOG_GET_PRIVATE (ET_MUSICBRAINZ_DIALOG (mbDialog));
     gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "btn_stop")),
                               sensitive);


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