From: Martin Ling Date: Wed, 25 Mar 2015 01:43:30 +0000 (+0000) Subject: Store a context pointer in struct sr_session. X-Git-Tag: libsigrok-0.4.0~558 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4ed5d21d048c8feed085530b7fda6ed265a5913f;p=libsigrok.git Store a context pointer in struct sr_session. --- 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;