On Jun 19, 2012 9:52 PM, <s...@apache.org> wrote:
>...
> +  if (resolve_conflicts_post_switch)
> +    {
> +      /* Remove the conflict resolution callback from the client context.
> +       * We invoke it after of the switch instead of during the switch.
*/
> +      conflict_func2 = ctx->conflict_func2;
> +      conflict_baton2 = ctx->conflict_baton2;
> +      ctx->conflict_func2 = NULL;
> +      ctx->conflict_baton2 = NULL;
> +    }

This feels like a terrible hack, of the worst kind.

The caller gives you a client context, and you change it on them. It's
theirs. Not yours to redefine.

Even worse, you never restore it! The context is now damaged because you
monkeyed with it. The context is NOT a single-use structure. It can live
for hours, over multiple operations, by design. But the above hack destroys
it.

I think you need to find a new approach.

Cheers,
-g

Reply via email to