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



commit 4c5dfd164a415809d911306b1f5f0315468a4a44
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 509fb3a..195499e 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 49ecb11..8103d11 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;
@@ -923,8 +923,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)))
@@ -938,6 +936,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));
@@ -1221,9 +1221,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);
@@ -1232,6 +1230,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));
@@ -1376,8 +1376,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)))
@@ -1390,6 +1388,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));
@@ -2046,6 +2046,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]