[Mesa-dev] [PATCH 14/45] st/nine: Unset vtxbuf on reset

Axel Davy axel.davy at ens.fr
Fri Jan 29 10:51:41 PST 2016


On 29/01/2016 17:49, Ilia Mirkin wrote:
> On Fri, Jan 29, 2016 at 11:08 AM, Axel Davy <axel.davy at ens.fr> wrote:
>> We forgot to reset vtxbuf.
>> This fixes some crashes.
>>
>> Signed-off-by: Axel Davy <axel.davy at ens.fr>
>> Reviewed-by: Patrick Rudolph <siro at das-labor.org>
>> ---
>>   src/gallium/state_trackers/nine/nine_state.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
>> index 2e77d62..561a68e 100644
>> --- a/src/gallium/state_trackers/nine/nine_state.c
>> +++ b/src/gallium/state_trackers/nine/nine_state.c
>> @@ -1314,8 +1314,10 @@ nine_state_clear(struct nine_state *state, const boolean device)
>>       nine_bind(&state->vs, NULL);
>>       nine_bind(&state->ps, NULL);
>>       nine_bind(&state->vdecl, NULL);
>> -    for (i = 0; i < PIPE_MAX_ATTRIBS; ++i)
>> +    for (i = 0; i < PIPE_MAX_ATTRIBS; ++i) {
>>           nine_bind(&state->stream[i], NULL);
>> +        state->vtxbuf[i].buffer = NULL;
> Not necessarily strictly wrong, but I would have expected a
> pipe_resource_reference(&buffer, NULL) -- are you not referencing them
> when setting either?
>
>    -ilia

We are not referencing them, but we reference the d3d structure 
referencing it.

That is when we do nine_bind(&state->stream[i], NULL), the pipe_resource 
may get dereferenced if the item
is freed.

Probably would be better reference and unreference the pipe_resource, I 
will look into it to improve that patch.

Axel

>
>> +    }
>>       nine_bind(&state->idxbuf, NULL);
>>       for (i = 0; i < NINE_MAX_SAMPLERS; ++i) {
>>           if (device &&
>> --
>> 2.7.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list