]> sigrok.org Git - pulseview.git/commitdiff
Fix off-by-one in PD menu list construction.
authorUwe Hermann <redacted>
Tue, 8 Oct 2013 20:36:57 +0000 (22:36 +0200)
committerUwe Hermann <redacted>
Tue, 8 Oct 2013 20:36:57 +0000 (22:36 +0200)
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.

pv/mainwindow.cpp

index dc5f981f7b3a5207ab0bc777e1656e292d12784b..0e971ce06cc7373f6da132479483101f187aa3c7 100644 (file)
@@ -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);
 {
        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()));
                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);
 }
 
        g_slist_free(l);
 }