[gupnp-tools/wip/search: 10/12] av-cp: Fix crash on invalid search expression
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-tools/wip/search: 10/12] av-cp: Fix crash on invalid search expression
- Date: Thu, 18 Aug 2016 08:45:47 +0000 (UTC)
commit af79045f7db9100cb605b5232633cfa0043072fe
Author: Jens Georg <mail jensge org>
Date: Wed Aug 17 22:27:32 2016 +0200
av-cp: Fix crash on invalid search expression
Signed-off-by: Jens Georg <mail jensge org>
src/av-cp/search-dialog.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/av-cp/search-dialog.c b/src/av-cp/search-dialog.c
index 0cba515..51c2d5d 100644
--- a/src/av-cp/search-dialog.c
+++ b/src/av-cp/search-dialog.c
@@ -143,7 +143,7 @@ search_dialog_on_search_done (GObject *source, GAsyncResult *res, gpointer user_
SearchDialogPrivate *priv = search_dialog_get_instance_private (self);
GError *error = NULL;
- char *xml;
+ char *xml = NULL;
guint32 total = 0;
guint32 returned = 0;
GUPnPDIDLLiteParser *parser;
@@ -155,8 +155,21 @@ search_dialog_on_search_done (GObject *source, GAsyncResult *res, gpointer user_
&total,
&returned,
&error)) {
+ GtkWidget *dialog = NULL;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (self),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CLOSE,
+ "Search failed: %s",
+ error->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
g_critical ("Failed to search: %s", error->message),
g_error_free (error);
+
+ goto out;
}
parser = gupnp_didl_lite_parser_new ();
@@ -164,6 +177,9 @@ search_dialog_on_search_done (GObject *source, GAsyncResult *res, gpointer user_
G_CALLBACK (on_didl_object_available),
self);
gupnp_didl_lite_parser_parse_didl (parser, xml, &error);
+ g_free (xml);
+
+out:
g_source_remove (priv->pulse_timer);
gtk_entry_set_progress_fraction (priv->search_dialog_entry, 0.0);
gtk_widget_set_sensitive (GTK_WIDGET (priv->search_dialog_entry), TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]