To Maurice and Arjen:

I need some help tracking down the cause of a segfault with
the menubutton command in bindings/tk/plwidget.tcl.

To follow what I have done you should be using the latest trunk
version (revision 12650 or later) which corrects a few issues with the
test for TEA compliance below.  It has obviously been a long time
since anyone tested the Tk bindings for PLplot this way, but it would
be nice to get this test working again because TEA is a pretty
important Tcl/Tk standard for extensions such as the Tk bindings
for PLplot.

The directions in examples/tk/README.tkdemos for testing TEA
compliance from the wish environment for PLplot say use (after
everything is built in the build tree that is required)

wish
lappend auto_path $prefix/share/plplot$VERSION | ../../bindings/tk
package require Pltk
source tkdemos.tcl

That final source command or equivalently

% plstdwin .
% plxframe .plw

segfaults with the Debian versions of Tcl/Tk8.5 and
itcl... version 3.  With a lot of puts commands, I finally discovered
that segfault occurred as a result of

menubutton $pmbut -text "Plot" -menu $pmenu($w) -relief raised

in the plw::create_pmenu proc defined in bindings/tk/plwidget.tcl

Here are the first few valgrind error messages associated with
this issue:

% lappend auto_path ../../bindings/tk
/usr/share/tcltk/tcl8.5 /usr/lib /usr/local/lib/tcltk
/usr/local/share/tcltk /usr/lib/tcltk /usr/share/tcltk
/usr/share/tcltk/tk8.5 /usr/share/tcltk/tk8.5/ttk ../../bindings/tk
% package require Pltk
5.9.10
% plstdwin .
% plxframe .plw
==10307== Use of uninitialised value of size 8
==10307==    at 0x54A2124: pthread_mutex_lock (pthread_mutex_lock.c:50)
==10307==    by 0x5701D86: XrmQGetResource (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
==10307==    by 0x56DE951: XGetDefault (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)
[...]
==10307== Invalid read of size 4
==10307==    at 0x54A2124: pthread_mutex_lock (pthread_mutex_lock.c:50)
==10307==    by 0x5701D86: XrmQGetResource (in
/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0)

I suspect the common location of pthread_mutex_lock for these first
two valgrind issues indicates some sort
of thread difficulty with the above menubutton command.

The above menubuttom command is executed as part of the create_pmenu
procedure that is set up with

pack append $w.ftop \
     [plw::create_pmenu $w $w.ftop.pmenu] \
     {left fill padx 12}

So the above $pmbut variable corresponds to $w.ftop.pmenu
in the calling environment.

I also tried replacing the above menubutton syntax with

menubutton $pmbut -text "Plot" -menu $pmbut.m -relief raised

That syntax corresponds to how we use menubutton elsewhere in
our scripts.  However, that version of the command also
caused an immediate segfault.

Therefore, I suspect something is wrong with either $w or
$w.ftop.pmenu in the above

[plw::create_pmenu $w $w.ftop.pmenu]

but I don't know what because I have pretty much come to the end of my
limited Tcl/Tk expertise.  Therefore, would one of you be willing to take
over now and debug this segfault yourself?  It would be good to be
able to demonstrate compliance with the TEA standard for our PLplot Tk
bindings again.

That appeal for help is mostly directed at Maurice because he has
access to Linux while there is a
barrier to entry for Arjen's Cygwin platform. An important
question on that platform is whether the Unix or Windows logic in
bindings/tk/pkgIndex.tcl.in is being executed.  If it is Windows, then
from the comments in that part of the logic, there is likely some
changes Arjen will have to make to get the above

package require Pltk

command executed under wish to provide the expected answer (5.9.10)
that you get on Linux. But once he has gotten that far on Cygwin, then
I suspect he will run into some sort of run-time trouble (as I do on
Linux) with the

source tkdemos.tcl

command which will boil down to some issue with the way the above
menubutton command is invoked.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to