X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=session.c;h=92ee648a631c77d41092beb3bf010f00c5537d30;hb=c9166745f23889e1c5abb010513733c829c00d1b;hp=0cd4e2000387c8591900e9495a3cc6d1700802e9;hpb=ed229aaa8ff66116967f75112be953940d4a3149;p=libsigrok.git diff --git a/session.c b/session.c index 0cd4e200..92ee648a 100644 --- a/session.c +++ b/session.c @@ -88,7 +88,7 @@ SR_API int sr_session_destroy(void) static void sr_dev_close(struct sr_dev *dev) { - if (dev->driver->dev_close) + if (dev && dev->driver && dev->driver->dev_close) dev->driver->dev_close(dev->driver_index); } @@ -321,22 +321,15 @@ SR_API int sr_session_run(void) /** * Halt the current session. * - * This requests the current session be stopped as soon as possible, for - * example on receiving an SR_DF_END packet. + * This function is deprecated and should not be used in new code, use + * sr_session_stop() instead. The behaviour of this function is identical to + * sr_session_stop(). * * @return SR_OK upon success, SR_ERR_BUG if no session exists. */ SR_API int sr_session_halt(void) { - if (!session) { - sr_err("session: %s: session was NULL", __func__); - return SR_ERR_BUG; - } - - sr_info("session: halting"); - session->running = FALSE; - - return SR_OK; + return sr_session_stop(); } /** @@ -366,8 +359,6 @@ SR_API int sr_session_stop(void) if (dev->driver) { if (dev->driver->dev_acquisition_stop) dev->driver->dev_acquisition_stop(dev->driver_index, dev); - if (dev->driver->cleanup) - dev->driver->cleanup(); } }