Bug 4

Summary: Calling sr_session_stop from a different thread causes a segfault with the demo driver
Product: libsigrok Reporter: mrnuke <mr.nuke.me>
Component: OtherAssignee: mrnuke <mr.nuke.me>
Status: RESOLVED FIXED    
Severity: normal CC: joel
Priority: High    
Version: unreleased development snapshot   
Target Milestone: ---   
Hardware: x86   
OS: Linux   
Bug Depends on:    
Bug Blocks: 45    

Description mrnuke 2012-12-17 18:10:29 CET
With the sigrok session running in a worker thread, if sr_session_stop is called from the main thread, it shuts down the pollfds used by the hardware drivers, without ensuring that the sigrok event loop is no longer using those pollfds.

On the demo driver, this involves shutting down the GIOChannels, causing a segfault when the sigrok event loop tries to use them. Usu PulseView with the demo driver to test.

This isn't a problem with just the demo driver; any driver's resources may be freed by sr_session_stop concurrently with the sigrok session running.

st_session_stop should work with the event loop in  athread-safe manner.
Comment 1 mrnuke 2012-12-17 19:41:35 CET
*** Bug 6 has been marked as a duplicate of this bug. ***
Comment 2 mrnuke 2013-01-31 15:28:17 CET
This just became a blocker for the PulseView release.
Comment 4 mrnuke 2013-02-02 17:29:22 CET
The above patchset has two independent changes that both need to be applied to solve this bug:

1) Fix the problem I mentioned on IRC about the use of cb_data in the demo driver.

2) Make sr_session_stop() thread-safe.

Applying only one of the above will not solve the problem.