我正在使用dbus-c++绑定为connman的服务API创建一个代理,该代理在dbus上公开。在connman的服务接口xml中找到的方法看起来是这样的:
<method name="GetProperties">
<arg type="a{sv}" direction="out"/>
</method>
使用"dbusxx-xml2cpp"实用程序自动生成的代理文件,创建了这样的方法:
Line 1: std::map< std::string, ::DBus::Variant > GetProperties()
Line 2: {
Line 3: ::DBus::CallMessage call;
Line 4: call.member("GetProperties");
Line 5: ::DBus::Message ret = invoke_method (call);
Line 6: ::DBus::MessageIter ri = ret.reader();
Line 7: std::map< std::string, ::DBus::Variant > argout;
Line 8: ri >> argout;
Line 9: return argout;
Line 10: }
在8号线上,我收到了警告/错误,在x86上运行带有libdbus-c++1-0包的Ubuntu 11.04(0~20110310-1ubuntu1):
process 30342: arguments to dbus_message_iter_open_container() were incorrect, assertion "(type == DBUS_TYPE_STRUCT && contained_signature == NULL) || (type == DBUS_TYPE_DICT_ENTRY && contained_signature == NULL) || (type == DBUS_TYPE_VARIANT && contained_signature != NULL) || (type == DBUS_TYPE_ARRAY && contained_signature != NULL)" failed in file dbus-message.c line 2677.
This is normally a bug in some application using the D-Bus library.
process 30342: dbus message iterator looks uninitialized or corrupted
还有更多。。。。。但是进程不会在此处终止/中止。
然而,在meego上,在基于手臂的目标上奔跑,进程在此断言错误后终止!
meego在基于arm的板上使用的封装是:libdbus-c++-0.5.1-4.3.armv7hl.rpm
libdbus-c++-devel-0.5.1-4.3armv7hl.rpm
请帮助解决此问题。迭代器是否有其他方法可以插入DICT值-(std::map<std::string,::DBus::Variant>)而不引发这些断言错误?
如有任何帮助,我们将不胜感激。
-Roy Samuel。
这似乎是dbus-c++库中的一个错误。更多信息可以在这里找到:
http://sourceforge.net/tracker/?func=detail&aid=3151818&group_id=236997&atid=1101682
我建议你选择:
- 修改dbus-c++的源代码(更改message.cpp中的一行)
- 使用异步版本的sjames(此处https://gitorious.org/~sjames/dbus cplusplus/async)
问候,
大脚怪。