input/saleae: keep previous channels across cleanup() call
The previous implementation of the cleanup() routine in the saleae input module kept user specified options, but lost the previously created list of sigrok channels. Keep it. Also make sure that reset() voids the previous copy after grabbing its value. To not unexpectedly release resources which still get referenced. This shall unbreak file-reload.
This commit is contained in:
parent
f403cb9de9
commit
003ad0ab8c
|
@ -1067,6 +1067,7 @@ static void cleanup(struct sr_input *in)
|
||||||
{
|
{
|
||||||
struct context *inc;
|
struct context *inc;
|
||||||
struct context_options save_opts;
|
struct context_options save_opts;
|
||||||
|
GSList *save_channels;
|
||||||
|
|
||||||
if (!in)
|
if (!in)
|
||||||
return;
|
return;
|
||||||
|
@ -1084,8 +1085,10 @@ static void cleanup(struct sr_input *in)
|
||||||
|
|
||||||
/* Clear internal state, but keep what .init() has provided. */
|
/* Clear internal state, but keep what .init() has provided. */
|
||||||
save_opts = inc->options;
|
save_opts = inc->options;
|
||||||
|
save_channels = inc->module_state.prev_channels;
|
||||||
memset(inc, 0, sizeof(*inc));
|
memset(inc, 0, sizeof(*inc));
|
||||||
inc->options = save_opts;
|
inc->options = save_opts;
|
||||||
|
inc->module_state.prev_channels = save_channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reset(struct sr_input *in)
|
static int reset(struct sr_input *in)
|
||||||
|
@ -1104,6 +1107,7 @@ static int reset(struct sr_input *in)
|
||||||
*/
|
*/
|
||||||
cleanup(in);
|
cleanup(in);
|
||||||
in->sdi->channels = inc->module_state.prev_channels;
|
in->sdi->channels = inc->module_state.prev_channels;
|
||||||
|
inc->module_state.prev_channels = NULL;
|
||||||
|
|
||||||
inc->module_state.got_header = FALSE;
|
inc->module_state.got_header = FALSE;
|
||||||
inc->module_state.header_sent = FALSE;
|
inc->module_state.header_sent = FALSE;
|
||||||
|
|
Loading…
Reference in New Issue