engine: Don't crash when emitting PropertiesChanged for NULL values
https://bugzilla.redhat.com/show_bug.cgi?id=1359479
This commit is contained in:
parent
2e2c819c8e
commit
894da7f6f3
@ -0,0 +1,47 @@
|
||||
From 3c121a4f86d01d27399f0c2bbace6df03800a1d1 Mon Sep 17 00:00:00 2001
|
||||
From: Kalev Lember <klember@redhat.com>
|
||||
Date: Mon, 25 Jul 2016 10:43:53 +0200
|
||||
Subject: [PATCH] engine: Don't crash when emitting PropertiesChanged for NULL
|
||||
values
|
||||
|
||||
When emitting PropertiesChanged, avoid putting NULL values into the
|
||||
changed_properties array (and then subsequently crashing for the NULL).
|
||||
Instead, use the invalidate_properties array that only lists the changed
|
||||
property names, avoiding issues with NULL GVariants.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1359479
|
||||
---
|
||||
src/pk-engine.c | 17 ++++++++++++-----
|
||||
1 file changed, 12 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/pk-engine.c b/src/pk-engine.c
|
||||
index f7ced65..f731f3a 100644
|
||||
--- a/src/pk-engine.c
|
||||
+++ b/src/pk-engine.c
|
||||
@@ -251,11 +251,18 @@ pk_engine_emit_offline_property_changed (PkEngine *engine,
|
||||
|
||||
/* build the dict */
|
||||
g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
|
||||
- g_variant_builder_init (&builder, G_VARIANT_TYPE_ARRAY);
|
||||
- g_variant_builder_add (&builder,
|
||||
- "{sv}",
|
||||
- property_name,
|
||||
- property_value);
|
||||
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
||||
+
|
||||
+ if (property_value == NULL) {
|
||||
+ g_variant_builder_add (&invalidated_builder,
|
||||
+ "s",
|
||||
+ property_name);
|
||||
+ } else {
|
||||
+ g_variant_builder_add (&builder,
|
||||
+ "{sv}",
|
||||
+ property_name,
|
||||
+ property_value);
|
||||
+ }
|
||||
g_dbus_connection_emit_signal (engine->priv->connection,
|
||||
NULL,
|
||||
PK_DBUS_PATH,
|
||||
--
|
||||
2.7.4
|
||||
|
||||
@ -8,13 +8,15 @@
|
||||
Summary: Package management service
|
||||
Name: PackageKit
|
||||
Version: 1.1.3
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: GPLv2+ and LGPLv2+
|
||||
URL: http://www.freedesktop.org/software/PackageKit/
|
||||
Source0: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz
|
||||
|
||||
# Fedora-specific: set Vendor.conf up for Fedora.
|
||||
Patch0: PackageKit-0.3.8-Fedora-Vendor.conf.patch
|
||||
# Backported from upstream
|
||||
Patch1: 0001-engine-Don-t-crash-when-emitting-PropertiesChanged-f.patch
|
||||
|
||||
BuildRequires: glib2-devel >= %{glib2_version}
|
||||
BuildRequires: xmlto
|
||||
@ -150,6 +152,7 @@ using PackageKit.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1 -b .fedora
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
%configure \
|
||||
@ -277,6 +280,10 @@ systemctl disable packagekit-offline-update.service > /dev/null 2>&1 || :
|
||||
%{_datadir}/vala/vapi/packagekit-glib2.vapi
|
||||
|
||||
%changelog
|
||||
* Wed Jul 27 2016 Kalev Lember <klember@redhat.com> - 1.1.3-2
|
||||
- engine: Don't crash when emitting PropertiesChanged for NULL values
|
||||
(#1359479)
|
||||
|
||||
* Thu Jul 14 2016 Kalev Lember <klember@redhat.com> - 1.1.3-1
|
||||
- Update to 1.1.3
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user