]> sigrok.org Git - libsigrok.git/commitdiff
Don't remove stray source from the session after stopping
authorBert Vermeulen <redacted>
Mon, 29 Apr 2013 22:04:39 +0000 (00:04 +0200)
committerBert Vermeulen <redacted>
Mon, 29 Apr 2013 22:09:20 +0000 (00:09 +0200)
It's up to the drivers and frontends to remove the sources they
added to the session.

Also don't tell the driver about a forced session stop more than
once, because it's sloppy.

Fixes bug 62.

session.c

index 266207259ca3c82e9c42c76208af3ae8afb88880..0c379c50259fc3802564377107fc02cd5c9bb454 100644 (file)
--- a/session.c
+++ b/session.c
@@ -260,8 +260,11 @@ static int sr_session_run_poll(void)
                         * just once per main event loop.
                         */
                        g_mutex_lock(&session->stop_mutex);
-                       if (session->abort_session)
+                       if (session->abort_session) {
                                sr_session_stop_sync();
+                               /* But once is enough. */
+                               session->abort_session = FALSE;
+                       }
                        g_mutex_unlock(&session->stop_mutex);
                }
        }
@@ -377,15 +380,6 @@ SR_PRIV int sr_session_stop_sync(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;
 }