]> sigrok.org Git - libsigrok.git/blobdiff - session.c
Eveything seems to work now except for triggers.
[libsigrok.git] / session.c
index 6a4a3c99704b4e2c5f371911594c685a9417ed06..440e3bd64970db1caab999e873b392f989f1b1d9 100644 (file)
--- a/session.c
+++ b/session.c
@@ -271,6 +271,7 @@ SR_API int sr_session_start(void)
 
        sr_info("session: starting");
 
+       ret = SR_OK;
        for (l = session->devs; l; l = l->next) {
                sdi = l->data;
                if ((ret = sdi->driver->dev_acquisition_start(sdi, sdi)) != SR_OK) {
@@ -362,6 +363,15 @@ SR_API int sr_session_stop(void)
                }
        }
 
+       /*
+        * Some sources may not be necessarily associated with a device.
+        * Those sources may still be present even after stopping all devices.
+        * We need to make sure all sources are removed, or we risk running the
+        * session in an infinite loop.
+        */
+       while (session->num_sources)
+               sr_session_source_remove(session->sources[0].poll_object);
+
        return SR_OK;
 }