[aravis] Re: Evaluator problem

  • From: Emmanuel Pacaud <emmanuel@xxxxxxxxx>
  • To: aravis@xxxxxxxxxxxxx
  • Date: Wed, 01 Aug 2012 17:54:27 +0200

Le mercredi 01 août 2012 à 14:43 +0000, tom.cobb@xxxxxxxxxxxxx a écrit :
> Ok, found the problem, but need help with the solution:
> 
> --- src/arvevaluator.c        (revision 80561)
> +++ src/arvevaluator.c        (working copy)
> @@ -888,7 +888,7 @@
>                                       status = 
> ARV_EVALUATOR_STATUS_PARENTHESES_MISMATCH;
>                                       goto CLEANUP;
>                               }
> -                             arv_evaluator_token_free (token);
> +                             //arv_evaluator_token_free (token);
>                               arv_evaluator_token_free (operator_stack->data);
>                               operator_stack = g_slist_delete_link 
> (operator_stack, operator_stack);
>                       } else {
> 
> This arv_evaluator_token_free is freeing token, which is passed (as
> previous_token) to arv_get_next_token. This causes
> arv_evaluator_token_is_right_parenthesis(previous_token) to return
> False, which causes "+" to be interpreted as a unary plus instead of a
> binary plus, causing our remaining operands error. There is a similar
> arv_evaluator_token_free in the code dealing with ",". Not quite sure
> where we should free this token, but I guess it needs to be delayed!

Thanks Tom.

I guess the right solution would be to free the token just after the
call to arv_get_next_token. Or store the ones that need to be freed in a
garbage slist, and free this list and its content before exiting
parse_expression.

        Emmanuel. 


Other related posts: