With current git head, PV crashes when trying to populate a logic channel popup for a device with triggers (e.g. FX2). Since the crash does not happen when LogicSignal::get_trigger_types() isn't called, I suspect the bug may be related to 7bb0fbf4d3809dbbd0fe5b35fc7e475b1065ae20 ("Update to new configuration API.").
Here's the log and backtrace for completeness: sr: [00:00.180524] hwdriver: sr_config_get(): key 30000 (samplerate) sdi 0x831b228 cg NULL -> uint64 20000 sr: [00:02.201833] hwdriver: sr_config_list(): key 30014 (triggermatch) sdi 0x831b228 cg NULL -> [1, 2, 3, 4, 5] (process:25103): GLib-CRITICAL **: g_variant_type_is_subtype_of: assertion 'g_variant_type_check (supertype)' failed Catchpoint 1 (exception thrown), 0xb6e9c4f8 in __cxa_throw () from /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libstdc++.so.6 (gdb) bt #0 0xb6e9c4f8 in __cxa_throw () from /usr/lib/gcc/i686-pc-linux-gnu/4.9.3/libstdc++.so.6 #1 0x081064da in Glib::Variant<std::vector<int, std::allocator<int> > > Glib::VariantBase::cast_dynamic<Glib::Variant<std::vector<int, std::allocator<int> > > >(Glib::VariantBase const&) () #2 0x08103ce6 in pv::view::LogicSignal::get_trigger_types() const () #3 0x08104873 in pv::view::LogicSignal::populate_popup_form(QWidget*, QFormLayout*) () #4 0x0810d74f in pv::view::Trace::create_popup_form() ()
Turns out it's the cast to vector<int32_t> that's causing issues. Here's a workaround that works for me: diff --git a/pv/view/logicsignal.cpp b/pv/view/logicsignal.cpp index 5584a1f..e126c8c 100644 --- a/pv/view/logicsignal.cpp +++ b/pv/view/logicsignal.cpp @@ -332,8 +332,20 @@ const vector<int32_t> LogicSignal::get_trigger_types() const if (sr_dev->config_check(ConfigKey::TRIGGER_MATCH, Capability::LIST)) { const Glib::VariantContainerBase gvar = sr_dev->config_list(ConfigKey::TRIGGER_MATCH); - return Glib::VariantBase::cast_dynamic< - Glib::Variant<vector<int32_t>>>(gvar).get(); + + vector<int32_t> ttypes; + + for (unsigned int i = 0; i < gvar.get_n_children(); i++) { + Glib::VariantBase tmp_vb; + gvar.get_child(tmp_vb, i); + + Glib::Variant<int32_t> tmp_v = + Glib::VariantBase::cast_dynamic< Glib::Variant<int32_t> >(tmp_vb); + + ttypes.push_back(tmp_v.get()); + } + + return ttypes; } else { return vector<int32_t>(); } Less elegant for sure but at least it allows me to continue working. @Martin: Feedback would be great ;)
The workaround looks fine to me. I don't know what the original problem was. Maybe it's a glibmm bug?
I couldn't find a bug report for glibmm and I'm not sure whether we should file one. As I'm assuming that I'm not the only one with a broken glibmm implementation (or whatever else may be causing it), I'm voting for including the workaround for the time being: https://github.com/abraxa/pulseview/commit/d60820d865b8044aa6447a49861eac0dd0a6a4d4 Maybe we can leave this bug open at low prio to be reminded to revisit the issue occasionally.
Fixed in d60820d865b8044aa6447a49861eac0dd0a6a4d4, thanks! Verified the fix, works fine for me. Closing the bug for now, but feel free to put a code comment at that place to remind readers of the code not to change back to the old version unless the issue is fully investigated.