On Thu, Mar 29, 2012 at 07:16, Dmitry Karpeev <[email protected]> wrote:
Here the problem isn't in needing to call PCReset() twice per se. The issue is that if the user uses the same PC object in two different KSPs and destroys one ksp, that will cause a PCReset() and invalidate the pc for the other ksp -- all despite increfing the pc.
Yeah, this is tricky. In this case, is it acceptable to break the dependency explicitly using PCSetType(ksp,PCNONE); // will decrement the reference count, but not PCReset() KSPDestroy(&ksp); Skipping the reset means that KSPReset() is basically always incorrect if the user created the PC (for example). I think a top-level KSPReset() should always reset the PC. Now maybe ksp->pc should be withheld by KSPDestroy() before calling KSPReset(); if the PC refct hits 0, it will be destroyed in the subsequent PCDestroy().
participants (1)
-
Jed Brown