From f224292974bed0d34333c5a2158968200e42238c Mon Sep 17 00:00:00 2001 From: Peter Stuge Date: Mon, 22 Oct 2012 01:12:52 +0200 Subject: [PATCH] Add struct sr_context to the sr_init() and sr_exit() calls libsigrok.git commit b8072700c1bc7d13ba004fd897668b56cec4ac62 adds struct sr_context to the public API, and changes sr_init() and sr_exit() to take a struct sr_context ** and struct sr_context * parameter respectively. struct sr_context is opaque, and all sr_init() and sr_exit() calls must be balanced. --- main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 56b4dd5f..ba6d6645 100644 --- a/main.cpp +++ b/main.cpp @@ -48,6 +48,8 @@ void usage() int main(int argc, char *argv[]) { int ret = 0; + struct sr_context *sr_ctx = NULL; + QApplication a(argc, argv); // Set some application metadata @@ -82,7 +84,7 @@ int main(int argc, char *argv[]) } // Initialise libsigrok - if (sr_init() != SR_OK) { + if (sr_init(&sr_ctx) != SR_OK) { qDebug() << "ERROR: libsigrok init failed."; return 1; } @@ -120,7 +122,8 @@ int main(int argc, char *argv[]) qDebug() << "ERROR: libsigrokdecode init failed."; } - sr_exit(); + if (sr_ctx) + sr_exit(sr_ctx); return ret; } -- 2.30.2