Sat 10 Feb 2007 06:49:01 PM UTC, comment #4:
I partially correct the bug.
We should always verify wether ans_sample is non NULL
before going on.
Nevertheless targa's code seems doing something wrong.
here is the code excerpt from gdisp_sampling.c:939
(in gdisp_samplingThread )
>>
provider->pSamplingThreadStatus = GD_THREAD_STOPPED;
/*
* Tell TSP core to stop sampling process.
*/
if (requestStatus == FALSE) {
requestStatus = 0;
}
else {
requestStatus = TSP_consumer_request_sample_destroy(provider->pHandle);
}
if (TSP_STATUS_OK != requestStatus) {
provider->pSamplingThreadStatus = GD_THREAD_SAMPLE_DESTROY_ERROR;
}
>>
When stopping sample targa compares requestStatus
with FALSE which is not an acceptable value
for requestStatus which should be compared with
TSP_STATUS_xxx values.
This compiles fine since FALSE is #defined to (0)
and TSP_STATUS_xxx is an enum value.
Nonetheless
FALSE == 0
and
TSP_STATUS_OK == 0
which means targa would never call
TSP_consumer_request_sample_destroy
which is a bad idea even if provider died.
After that when you press targa "start sampling"
button again the process gets a SIGPIPE after
an RPC error.
RPC error is OK since RPC server died and RPC
client has a dangling connection to it.
Now I don't know why we get SIGPIPE for this...
I commit the change in TSP core for proper
check of NULL value for ans_sample.
I have added better returned value for
TSP_consumer_read_sample when provider died.
Euskadi may re-read the code of gdisp_sampling.c
of targa in order to seek;
(requestStatus == FALSE) and may be put
a valid code check.
I may do it myself but may be you want to do
an overall check for this kind of things in targa.
The check against FALSE/TRUE has been right in the past
but nowadays all tsp_consumer_xxx functions should return
TSP_STATUS_xxx codes unless they return typed "values" like:
TSP_consumer_get_channel_id
or
TSP_consumer_get_connected_name
|