PhClearWidget

I have a problem using PhClearWidget , when I call the plotting funcion with with a timer. I have a scatter plot (PtPixel) and a polygon as line plot It works except that when I add PhClearWidget it never return to the timer and just hangs there ( if i click to reset the timer, it crashes. So rigth now I DONT have a ptClearWidget and the plots keep cluttering the PtPane that holds the plot. I tried PtReRealizeWidget and it does not get rid of the old stuff.

the function gets called from the timer callback and creates the widget as follows:

PtWidget_t *Wpolygon;
    ......................

PtSetArg(&argt[0], Pt_ARG_POINTS, pointsPlot, npts ) ;
PtSetArg(&argt[1], Pt_ARG_COLOR, Pg_RED , 1 ) ;
Wpolygon = PtCreateWidget( PtPolygon, Wplot ,1, argt ) ;	 
    ............
    return (PtContinue);

TIA

L