hello world

when using the (default) output module "analog"
sigrok-cli crashes with
g_atomic_ref_count_dec: assertion 'g_atomic_int_get (arc) > 0' failed
and i need "stty echo" to restore my terminal, cos clear_anykey() is not called

i call sigrok-cli like
sigrok-cli --continuous --driver hantek-dso --output-format analog
--output-file out.analog

this happens cos analog.c / cleanup() does a double free in

```
  g_variant_unref(options[0].def);
  g_slist_free_full(options[0].values, (GDestroyNotify)g_variant_unref);
```

maybe the analog module should not be started twice?
see: libsigrok-cli / session.c / datafeed_in()

```
        static const struct sr_output *o = NULL;
        static const struct sr_output *oa = NULL;
// ...
                if (!(o = setup_output_format(sdi, &outfile)))
                        g_critical("Failed to initialize output module.");

                /* Set up backup analog output module. */
                if (outfile)
                        oa = sr_output_new(sr_output_find("analog"), NULL,
                                        sdi, NULL);
```

to avoid the double free, i added

```
  if (options[0].def != NULL) {
    g_variant_unref(options[0].def);
    options[0].def = NULL;
  }

  if (options[0].values != NULL) {
    g_slist_free_full(options[0].values, (GDestroyNotify)g_variant_unref);
    options[0].values = NULL;
  }
```

maybe there is a more "glib way", but this works for me


_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to