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;