Subject: | org.freedesktop.DBus.Properties.GetAll doesn't return values as variants |
Although the GetAll method is declared as [["dict", "string",
["variant"]]] it doesn't force the type of the return value. So the
return type is whatever the guessing system choose, which seems to only
work if all the properties are of the same type.
This make my app (which worked with v0.33.6) crash with messages like :
process 4657: Array or variant type requires that type boolean be
written, but int64 was written.
The overall signature expected here was 'a{sb}' and we are on byte 4 of
that signature.
I made it work with the attached patch, but you might want to do it
differently.
Subject: | GetAll.diff |
--- a/lib/Net/DBus/Object.pm
+++ b/lib/Net/DBus/Object.pm
@@ -616,7 +616,14 @@
my $reply = $connection->make_method_return_message($message);
- $self->_introspector->encode($reply, "methods", "Get", "returns", \%values);
+ my $Vtype=
+ [ &Net::DBus::Binding::Message::TYPE_DICT_ENTRY,
+ [ &Net::DBus::Binding::Message::TYPE_STRING,
+ [ &Net::DBus::Binding::Message::TYPE_VARIANT,
+ [],
+ ]]];
+ my $values= Net::DBus::Binding::Value->new($Vtype,\%values);
+ $self->_introspector->encode($reply, "methods", "Get", "returns", $values);
return $reply;
}