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.
int main(int argc, char *argv[])
{
int ret = 0;
+ struct sr_context *sr_ctx = NULL;
+
QApplication a(argc, argv);
// Set some application metadata
}
// Initialise libsigrok
- if (sr_init() != SR_OK) {
+ if (sr_init(&sr_ctx) != SR_OK) {
qDebug() << "ERROR: libsigrok init failed.";
return 1;
}
qDebug() << "ERROR: libsigrokdecode init failed.";
}
- sr_exit();
+ if (sr_ctx)
+ sr_exit(sr_ctx);
return ret;
}