I'm trying to implement Gnome mediakey support using dbus-cpp, but I get a crash when I try to use the MediaPlayerKeyPressed signal.
See attached project. Running it will crash with this stacktrace:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000478fd0 in std::_Hashtable<std::tuple<std::string, std::string>, std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> >, std::allocator<std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> > >, std::__detail::_Select1st, std::equal_to<std::tuple<std::string, std::string> >, std::hash<std::tuple<std::string, std::string> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node(unsigned long, std::tuple<std::string, std::string> const&, unsigned long) const (this=0x693ab0, __n=3466715, __k=..., __code=14562117148223712363) at /usr/include/c++/4.8/bits/hashtable.h:1159
1159 __node_base* __prev_p = _M_buckets[__n];
(gdb) bt
#0 0x0000000000478fd0 in std::_Hashtable<std::tuple<std::string, std::string>, std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> >, std::allocator<std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> > >, std::__detail::_Select1st, std::equal_to<std::tuple<std::string, std::string> >, std::hash<std::tuple<std::string, std::string> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node(unsigned long, std::tuple<std::string, std::string> const&, unsigned long) const (this=0x693ab0, __n=3466715, __k=..., __code=14562117148223712363)
at /usr/include/c++/4.8/bits/hashtable.h:1159
#1 0x0000000000476faa in std::_Hashtable<std::tuple<std::string, std::string>, std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> >, std::allocator<std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> > >, std::__detail::_Select1st, std::equal_to<std::tuple<std::string, std::string> >, std::hash<std::tuple<std::string, std::string> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_node(unsigned long, std::tuple<std::string, std::string> const&, unsigned long) const (this=0x693ab0, __bkt=3466715, __key=..., __c=14562117148223712363) at /usr/include/c++/4.8/bits/hashtable.h:604
#2 0x000000000047724c in std::__detail::_Map_base<std::tuple<std::string, std::string>, std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> >, std::allocator<std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> > >, std::__detail::_Select1st, std::equal_to<std::tuple<std::string, std::string> >, std::hash<std::tuple<std::string, std::string> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true>, true>::operator[](std::tuple<std::string, std::string> const&) (this=0x693ab0, __k=...) at /usr/include/c++/4.8/bits/hashtable_policy.h:489
#3 0x00000000004751b1 in std::unordered_map<std::tuple<std::string, std::string>, std::function<void (std::shared_ptr<core::dbus::Message> const&)>, std::hash<std::tuple<std::string, std::string> >, std::equal_to<std::tuple<std::string, std::string> >, std::allocator<std::pair<std::tuple<std::string, std::string> const, std::function<void (std::shared_ptr<core::dbus::Message> const&)> > > >::operator[](std::tuple<std::string, std::string> const&) (this=0x693ab0, __k=...) at /usr/include/c++/4.8/bits/unordered_map.h:596
#4 0x000000000047351b in core::dbus::MessageRouter<std::tuple<std::string, std::string> >::install_route(std::tuple<std::string, std::string> const&, std::function<void (std::shared_ptr<core::dbus::Message> const&)>) (this=0x693a68, key=..., handler=...) at /usr/include/core/dbus/message_router.h:69
#5 0x0000000000475882 in core::dbus::Signal<org::gnome::SettingsDaemon::MediaKeys::Signals::MediaPlayerKeyPressed, std::tuple<std::string, std::string> >::Signal (this=0x691dd0, parent=..., interface=...,
name=...) at /usr/include/core/dbus/impl/signal.h:290
#6 0x0000000000474208 in core::dbus::Signal<org::gnome::SettingsDaemon::MediaKeys::Signals::MediaPlayerKeyPressed, std::tuple<std::string, std::string> >::make_signal (parent=..., interface=..., name=...)
at /usr/include/core/dbus/impl/signal.h:268
#7 0x0000000000471ab0 in core::dbus::Object::get_signal<org::gnome::SettingsDaemon::MediaKeys::Signals::MediaPlayerKeyPressed> (this=0x693a40) at /usr/include/core/dbus/impl/object.h:184
#8 0x000000000046dd6b in main () at /home/bohrarper/src/dbus/dbus.cpp:61
This commit has commented out a similar thing in one of the examples, without any explanation as to why:
http:// bazaar. launchpad. net/~phablet- team/dbus- cpp/trunk/ revision/ 17#examples/ ofono/main. cpp