From 4ed5d21d048c8feed085530b7fda6ed265a5913f Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Wed, 25 Mar 2015 01:43:30 +0000 Subject: [PATCH] Store a context pointer in struct sr_session. --- src/libsigrok-internal.h | 2 ++ src/session.c | 1 + 2 files changed, 3 insertions(+) diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index a12b8d53..e0c700e3 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -663,6 +663,8 @@ SR_PRIV int sr_source_add_channel(GIOChannel *channel, int events, int timeout, /*--- session.c -------------------------------------------------------------*/ struct sr_session { + /** Context this session exists in. */ + struct sr_context *ctx; /** List of struct sr_dev_inst pointers. */ GSList *devs; /** List of struct sr_dev_inst pointers owned by this session. */ diff --git a/src/session.c b/src/session.c index 736b2aa5..276c5d17 100644 --- a/src/session.c +++ b/src/session.c @@ -82,6 +82,7 @@ SR_API int sr_session_new(struct sr_context *ctx, session = g_malloc0(sizeof(struct sr_session)); + session->ctx = ctx; session->source_timeout = -1; session->running = FALSE; session->abort_session = FALSE;