in reply to Re^2: Script using Tk and LibXML crashing (Devel::Trace)
in thread Script using Tk and LibXML crashing

hmm,

I'd say kick that up to rt://Tk

Does it happen if you avoid getOpenFile? Like so

#!/usr/bin/perl -- use strict; use warnings; use XML::LibXML; use Tk; my $xpc; my $mw = MainWindow->new( -title => 'GUI' ); $mw->Button( -text => 'Load XML', -command => [ \&tk_Load_Export , \$xpc ], )->grid(-column => '0', -row => '0', -sticky => 'e'); MainLoop; sub tk_Load_Export { my( $ref_xpc ) = @_; #~ my $filename = $mw->getOpenFile( -title => 'Load XML', -default +extension => '.xml', -initialdir => '.' ) or return; my $filename = 'C:\bigbigxml.xml'; import_XML( $filename , $ref_xpc ); } sub import_XML { my( $filename , $ref_xpc ) = @_; print "Reading the XML file $filename\n\n"; undef $$xpc; # free previous $dom my $dom = XML::LibXML->load_xml(location => $filename, huge => 1); $$xpc = XML::LibXML::XPathContext->new($dom); print "XML imported\n"; }

Replies are listed 'Best First'.
Re^4: Script using Tk and LibXML crashing (Devel::Trace)
by misczol (Novice) on Aug 07, 2019 at 10:34 UTC
    Yes, the same thing happens. I'm getting the same error.
    >> C:/Strawberry/perl/site/lib/XML/LibXML.pm:790: return $dom; >> test2.pl:27: $$xpc = XML::LibXML::XPathContext->new($dom); >> test2.pl:28: print "XML imported\n"; XML imported >> C:/Strawberry/perl/site/lib/Tk.pm:424: DoOneEvent(0); >> C:/Strawberry/perl/site/lib/Tk.pm:424: DoOneEvent(0); Free to wrong pool 31a960 not 2020202020200a at C:/Strawberry/perl/sit +e/lib/Tk.pm line 424.