From: Uwe Hermann Date: Tue, 8 Oct 2013 20:36:57 +0000 (+0200) Subject: Fix off-by-one in PD menu list construction. X-Git-Tag: pulseview-0.2.0~280 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=98bac9636ee62a8863760a8b8381019a6a546173;p=pulseview.git Fix off-by-one in PD menu list construction. A minor logic bug caused the first PD in the list of PDs to be ignored and not to be added to the decoder list the user has access to. I.e., one of the available decoders couldn't be used at all in PulseView. This fixes bug #164. --- diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index dc5f981f..0e971ce0 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -305,14 +305,14 @@ void MainWindow::setup_add_decoders(QMenu *parent) { GSList *l = g_slist_sort(g_slist_copy( (GSList*)srd_decoder_list()), decoder_name_cmp); - while ((l = l->next)) { + do { QAction *const action = parent->addAction(QString( ((srd_decoder*)l->data)->name)); action->setData(qVariantFromValue(l->data)); _decoders_add_mapper.setMapping(action, action); connect(action, SIGNAL(triggered()), &_decoders_add_mapper, SLOT(map())); - } + } while ((l = l->next)); g_slist_free(l); }