!32 context: Small code cleanup

From: @linker99 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
This commit is contained in:
openeuler-ci-bot 2023-11-24 06:29:27 +00:00 committed by Gitee
commit bfffa6c169
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 35bba25ca93701e330ea258f15f0310f11b27774 Mon Sep 17 00:00:00 2001
From: Jens Georg <mail@jensge.org>
Date: Wed, 19 May 2021 19:43:46 +0200
Subject: [PATCH] context: Small code cleanup
---
libgupnp/gupnp-context.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index 460179e..58d3abf 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -331,10 +331,7 @@ gupnp_context_dispose (GObject *object)
context = GUPNP_CONTEXT (object);
priv = gupnp_context_get_instance_private (context);
- if (priv->session) {
- g_object_unref (priv->session);
- priv->session = NULL;
- }
+ g_clear_object (&priv->session);
while (priv->host_path_datas) {
HostPathData *data;
@@ -344,10 +341,7 @@ gupnp_context_dispose (GObject *object)
gupnp_context_unhost_path (context, data->server_path);
}
- if (priv->server) {
- g_object_unref (priv->server);
- priv->server = NULL;
- }
+ g_clear_object (&priv->server);
/* Call super */
object_class = G_OBJECT_CLASS (gupnp_context_parent_class);
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: gupnp
Version: 1.2.4
Release: 5
Release: 6
Summary: UPnP devices & control points creation framework
License: LGPLv2+
URL: http://www.gupnp.org/
@ -10,6 +10,7 @@ Patch1: ServiceProxy-Remove-bogos-function-rename.patch
Patch2: linux-cm-Fds-can-be-0.patch
Patch3: service-action-Protect-against-unsent-message-use.patch
Patch4: service-action-Do-not-leak-message-if-never-sent.patch
Patch5: context-Small-code-cleanup.patch
BuildRequires: gssdp-devel >= 1.2.3 gtk-doc gobject-introspection-devel >= 1.36
BuildRequires: libsoup-devel libxml2-devel libuuid-devel vala meson
@ -78,6 +79,9 @@ This package contains help file and developer documentation for gupnp.
%{_mandir}/man1/gupnp-binding-tool-*
%changelog
* Thu Nov 23 2023 fandehui <fandehui@xfusion.com> - 1.2.4-6
- context: Small code cleanup
* Thu Nov 9 2023 fandehui <fandehui@xfusion.com> - 1.2.4-5
- service-action: Do not leak message if never sent