Bug 888 - Not loading all saved decoder stacks
Summary: Not loading all saved decoder stacks
Status: RESOLVED FIXED
Alias: None
Product: PulseView
Classification: Unclassified
Component: Other (show other bugs)
Version: unreleased development snapshot
Hardware: x86 Windows
: Normal major
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
: 833 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-02-01 04:32 CET by aaatom
Modified: 2017-07-06 01:01 CEST (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description aaatom 2017-02-01 04:32:09 CET
Overview:
---------
On start PulseView loads only every other decoder stack (which were saved on previous exit).
This results in loosing half of the decoders on every exit/open, eventually leaving only one.

Steps to Reproduce:
-------------------
1. Add several decoders using the toolbar button and menu. No need for setting them up.
2. Close PulseView
3. Run PulseView again

Result:
-------
Only every other decoder has been restored.

More details observed:
----------------------
On exit, PulseView saves decoder stacks into a registry key that corresponds to the session tab, e.g.
   HKEY_CURRENT_USER\Software\sigrok\PulseView\Session0\decoder_stack0
   HKEY_CURRENT_USER\Software\sigrok\PulseView\Session0\decoder_stack1
   etc.
Each decoder stack key is given a number starting at 0. It works OK.

However, on start PulseView reads that info and loads decoder stacks - but only those with even numbers.
In other words, it skips every other decoder stack.

For example, if there are 5 decoder stacks saved to registry, numbered 0, 1, 2, 3 and 4, only stacks 0, 2 and 4 will be loaded.


Build Date & Platform:
----------------------
This applies to the Windows nightly build on Jan 31st 2017 downloaded from http://sigrok.org/wiki/Windows page (why is there no file version info in the exe?).
Comment 1 Soeren Apel 2017-06-23 22:13:43 CEST
Cause for the bug is here:

http://sigrok.org/gitweb/?p=pulseview.git;a=blob;f=pv/session.cpp#l323

for (int i = 0; i < stacks; i++) {
        settings.beginGroup("decoder_stack" + QString::number(i++));

Obviously, i should only be incremented once.
Obviously, it wasn't obvious to me that I messed that up :)

Will be fixed as part of my upcoming patch set.
Comment 2 Soeren Apel 2017-06-26 22:49:03 CEST
*** Bug 833 has been marked as a duplicate of this bug. ***
Comment 3 Uwe Hermann 2017-07-06 01:01:48 CEST
Fixed in 88870fffb650365d2ece97e41981ad78fec06600, thanks!