|
From: <ai...@us...> - 2013-11-28 06:00:50
|
Revision: 12773
http://sourceforge.net/p/plplot/code/12773
Author: airwin
Date: 2013-11-28 06:00:42 +0000 (Thu, 28 Nov 2013)
Log Message:
-----------
Document and rearrange order of initializing members of plPlotterPtr
and plFramePtr structures in same order as the members of the
structures are defined to help keep track of what is initialized and
what not. There is no change in initialization of plFramePtr, but
this analysis showed that both plPlotterPtr->double_buffer and
plPlotterPtr->pldis (and several other members which were also not
initialized in the working plFramePtr case) were unitialized. The
double_buffer initialization quiets a valgrind warning about an
uninitialized variable. The pldis initialization may not be necessary
(because valgrind did not complain about it), but it does follow what
is done in the plFramePtr case.
These plPlotterPtr initialization changes made no difference to the
erratic on-again off-again issue with test_wish_runAllDemos where
sometimes the examples run at the touch of the button consistently for
one particular compilation of plplotter.c, and other times they error
out consistently for a different compilation of plplotter.c with
messages like
invalid command name "x00"
So it appears some other issue is the source of the complete change in
behaviour of the plplotter Tcl/Tk extension package from one
compilation of plplotter.c to the next.
Modified Paths:
--------------
trunk/bindings/tk/plframe.c
trunk/bindings/tk-x-plat/plplotter.c
Modified: trunk/bindings/tk/plframe.c
===================================================================
--- trunk/bindings/tk/plframe.c 2013-11-27 20:22:18 UTC (rev 12772)
+++ trunk/bindings/tk/plframe.c 2013-11-28 06:00:42 UTC (rev 12773)
@@ -383,43 +383,58 @@
}
plFramePtr = (PlFrame *) ckalloc( sizeof ( PlFrame ) );
+
+ // Initialize in the same order as the members of the struct just
+ // to keep track of what is initialized and what not.
+
plFramePtr->tkwin = new;
plFramePtr->display = Tk_Display( new );
plFramePtr->interp = interp;
- plFramePtr->xorGC = NULL;
+ //plFramePtr->widgetCMD = <initialized below for HAVE_ITCL case>
plFramePtr->border = NULL;
+ //plFramePtr->borderWidth = <uninitialized>
+ //plFramePtr->relief = <uninitialized>
+ plFramePtr->width = Tk_Width( plFramePtr->tkwin );
+ plFramePtr->height = Tk_Height( plFramePtr->tkwin );
plFramePtr->cursor = None;
- plFramePtr->xhair_cursor = None;
plFramePtr->flags = 0;
- plFramePtr->width = Tk_Width( plFramePtr->tkwin );
- plFramePtr->height = Tk_Height( plFramePtr->tkwin );
+ plFramePtr->tkwin_initted = 0;
+ // Associate new PLplot stream with this widget
+ plmkstrm( &plFramePtr->ipls );
+ plgpls( &plFramePtr->pls );
+ plFramePtr->ipls_save = 0;
+ plFramePtr->plr = (PLRDev *) ckalloc( sizeof ( PLRDev ) );
+ plFramePtr->bgColor = NULL;
+ plFramePtr->plpr_cmd = NULL;
+ plFramePtr->pldis.x = 0;
+ plFramePtr->pldis.y = 0;
+ plFramePtr->pldis.width = 0;
+ plFramePtr->pldis.height = 0;
plFramePtr->prevWidth = 0;
plFramePtr->prevHeight = 0;
+ plFramePtr->SaveFnam = NULL;
+ // plFramePtr->devDesc = <uninitialized, to be malloced?>;
+ // plFramePtr->devName = <uninitialized, to be malloced?>;
+ plFramePtr->xorGC = NULL;
+ // plFram Ptr->pts = <uninitialized array>;
plFramePtr->continue_draw = 0;
- plFramePtr->ipls = 0;
- plFramePtr->ipls_save = 0;
- plFramePtr->tkwin_initted = 0;
- plFramePtr->bgColor = NULL;
- plFramePtr->plpr_cmd = NULL;
+ plFramePtr->xhair_cursor = None;
+ plFramePtr->xl = 0.;
+ plFramePtr->yl = 0.;
+ plFramePtr->xr = 1.;
+ plFramePtr->yr = 1.;
+ plFramePtr->xScrollCmd = NULL;
+ plFramePtr->yScrollCmd = NULL;
plFramePtr->bopCmd = NULL;
plFramePtr->eopCmd = NULL;
plFramePtr->xhairs = 0;
plFramePtr->drawing_xhairs = 0;
+ // plFram Ptr->xhair_x = <uninitialized array>;
+ // plFram Ptr->xhair_y = <uninitialized array>;
plFramePtr->rband = 0;
plFramePtr->drawing_rband = 0;
- plFramePtr->xScrollCmd = NULL;
- plFramePtr->yScrollCmd = NULL;
- plFramePtr->xl = 0.;
- plFramePtr->yl = 0.;
- plFramePtr->xr = 1.;
- plFramePtr->yr = 1.;
- plFramePtr->SaveFnam = NULL;
- plFramePtr->pldis.x = 0;
- plFramePtr->pldis.y = 0;
- plFramePtr->pldis.width = 0;
- plFramePtr->pldis.height = 0;
+ // plFram Ptr->rband_pt = <uninitialized array>;
- plFramePtr->plr = (PLRDev *) ckalloc( sizeof ( PLRDev ) );
plr = plFramePtr->plr;
plr->pdfs = NULL;
plr->at_bop = 0;
@@ -427,11 +442,6 @@
plr->iodev = (PLiodev *) ckalloc( sizeof ( PLiodev ) );
plr_start( plr );
-// Associate new PLplot stream with this widget
-
- plmkstrm( &plFramePtr->ipls );
- plgpls( &plFramePtr->pls );
-
// Set up stuff for rubber-band drawing
plFramePtr->xhair_cursor =
Modified: trunk/bindings/tk-x-plat/plplotter.c
===================================================================
--- trunk/bindings/tk-x-plat/plplotter.c 2013-11-27 20:22:18 UTC (rev 12772)
+++ trunk/bindings/tk-x-plat/plplotter.c 2013-11-28 06:00:42 UTC (rev 12773)
@@ -372,6 +372,9 @@
Tk_SetClass( tkwin, "Plframe" );
plPlotterPtr = (PlPlotter *) malloc( sizeof ( PlPlotter ) );
+
+ // Initialize in the same order as the members of the struct just
+ // to keep track of what is initialized and what not.
plPlotterPtr->tkwin = tkwin;
plPlotterPtr->display = Tk_Display( tkwin );
plPlotterPtr->interp = interp;
@@ -379,46 +382,57 @@
Tcl_CreateCommand( interp, Tk_PathName( plPlotterPtr->tkwin ),
(Tcl_CmdProc *) PlPlotterWidgetCmd, (ClientData) plPlotterPtr,
(Tcl_CmdDeleteProc *) NULL );
- plPlotterPtr->xorGC = NULL;
plPlotterPtr->border = NULL;
+ //plPlotterPtr->borderWidth = <uninitialized>;
+ //plPlotterPtr->relief = <uninitialized>;
+ plPlotterPtr->width = Tk_Width( plPlotterPtr->tkwin );
+ plPlotterPtr->height = Tk_Height( plPlotterPtr->tkwin );
plPlotterPtr->cursor = None;
- plPlotterPtr->xhair_cursor = None;
plPlotterPtr->flags = 0;
- plPlotterPtr->width = Tk_Width( plPlotterPtr->tkwin );
- plPlotterPtr->height = Tk_Height( plPlotterPtr->tkwin );
+ plPlotterPtr->tkwin_initted = 0;
+ // Associate new PLplot stream with this widget
+ plmkstrm( &plPlotterPtr->ipls );
+ plgpls( &plPlotterPtr->pls );
+ plPlotterPtr->ipls_save = 0;
+ plPlotterPtr->plr = (PLRDev *) malloc( sizeof ( PLRDev ) );
+ plPlotterPtr->plpr_cmd = NULL;
+ plPlotterPtr->active_plot = 1;
+ plPlotterPtr->isActive = 0;
+ plPlotterPtr->pldis.x = 0;
+ plPlotterPtr->pldis.y = 0;
+ plPlotterPtr->pldis.width = 0;
+ plPlotterPtr->pldis.height = 0;
plPlotterPtr->prevWidth = 0;
plPlotterPtr->prevHeight = 0;
+ plPlotterPtr->SaveFnam = NULL;
+ // plPlotterPtr->devDesc = <uninitialized, to be malloced?>;
+ // plPlotterPtr->devName = <uninitialized, to be malloced?>;
+ plPlotterPtr->xorGC = NULL;
+ // plPlotterPtr->pts = <uninitialized array>;
plPlotterPtr->continue_draw = 0;
- plPlotterPtr->ipls = 0;
- plPlotterPtr->ipls_save = 0;
- plPlotterPtr->tkwin_initted = 0;
- plPlotterPtr->plpr_cmd = NULL;
+ plPlotterPtr->xhair_cursor = None;
+ plPlotterPtr->xl = 0.;
+ plPlotterPtr->yl = 0.;
+ plPlotterPtr->xr = 1.;
+ plPlotterPtr->yr = 1.;
+ plPlotterPtr->xScrollCmd = NULL;
+ plPlotterPtr->yScrollCmd = NULL;
plPlotterPtr->bopCmd = NULL;
plPlotterPtr->eopCmd = NULL;
plPlotterPtr->xhairs = 0;
- plPlotterPtr->active_plot = 1;
- plPlotterPtr->isActive = 0;
plPlotterPtr->drawing_xhairs = 0;
+ // plPlotterPtr->xhair_x = <uninitialized array>;
+ // plPlotterPtr->xhair_y = <uninitialized array>;
plPlotterPtr->rband = 0;
plPlotterPtr->drawing_rband = 0;
- plPlotterPtr->xScrollCmd = NULL;
- plPlotterPtr->yScrollCmd = NULL;
- plPlotterPtr->xl = 0.;
- plPlotterPtr->yl = 0.;
- plPlotterPtr->xr = 1.;
- plPlotterPtr->yr = 1.;
- plPlotterPtr->SaveFnam = NULL;
+ // plPlotterPtr->rband_pt = <uninitialized array>;
+ plPlotterPtr->double_buffer = 1;
- plPlotterPtr->plr = (PLRDev *) malloc( sizeof ( PLRDev ) );
plr = plPlotterPtr->plr;
plr->pdfs = NULL;
plr->iodev = (PLiodev *) malloc( sizeof ( PLiodev ) );
plr_start( plr );
-// Associate new PLplot stream with this widget
-
- plmkstrm( &plPlotterPtr->ipls );
- plgpls( &plPlotterPtr->pls );
// Tell the stream about myself
plPlotterPtr->pls->plPlotterPtr = plPlotterPtr;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|