Ticket Hash: | 39342ca8ea9131fb16cf247430ace64f73c8621b | |||
Title: | iwidgets::labeledframe causes segfault | |||
Status: | Open | Type: | Code_Defect | |
Severity: | Critical | Priority: | Immediate | |
Subsystem: | Resolution: | Open | ||
Last Modified: | 2017-07-06 20:17:46 | |||
Version Found In: | 4.0.1rc1 | |||
User Comments: | ||||
anonymous added on 2015-02-12 17:04:11:
The error is a segfault that doesn't always happen. In my case and on my machine, I always either got a segfault OR an error. Here's some sample code, but you may need to add empty loops, some [puts] or [packs] or similar to try to trigger it. package require Tk package require itk package require Iwidgets set mainf [frame .f] set lf1 [iwidgets::labeledframe $mainf.lf1 -labeltext "label 1" -labelpos nw -ipadx 8 -ipady 8] set lf2 [iwidgets::labeledframe $mainf.lf2 -labeltext "label 2" -labelpos nw -ipadx 8 -ipady 8] The culprit seems to be _initTable called by the labeledframe constructor. That thing deletes itself after running. (For no good reason that I can see, but still, that's an allowed action.) My guess is that leaves a dangling pointer in the first object created. dgp added on 2015-02-12 20:10:06: The iwidgets trunk mirrored at core.tcl.tk has the redefinition of _initTable commented out and another approach taken. I'd guess that means Rene has encountered the same issue and introduced this workaround into the patch. dgp added on 2015-02-12 20:17:55: I put the redef back in place in Labeledframe, and when I close the window, get the panic Tcl_Release couldn't find reference for 0x7ff3dcb34290 It does look like a resource management bug.....somewhere.... dgp added on 2015-02-12 20:22:00: There's an ITCL_PRESERVE_DEBUG setting. Now we just need someone who knows how to use it. :) dgp added on 2015-02-12 21:36:29: Tracked that down to Preserve/Release imbalance in Itcl 4.0.3rc Committed a fix, and now this demo script doesn't panic on me anymore. Testing to see if that fixes the problem on your end as well would be appreciated. anonymous added on 2015-02-13 12:35:50: I took the 2 line patch from itcl and applied it to itcl 4.0.3rc0 and it didn't fix anything. After doing that, I realized my test program doesn't even include itcl... anonymous added on 2015-02-13 12:36:29: I took the 2 line patch from itcl and applied it to itcl 4.0.3rc0 and it didn't fix anything. After doing that, I realized my test program doesn't even include itcl... dgp added on 2015-02-18 13:20:58: Any script using itk is also using itcl. dgp added on 2015-02-18 13:21:14: Any script using itk is also using itcl. dgp added on 2015-02-18 13:21:38: Any script using itk is also using itcl. anonymous added on 2015-02-18 13:43:56: Afterwards, I thought that might be true. Just to be sure, I checked this report again. I applied this patch: http://core.tcl.tk/itcl/ci/0206ee920837fec7?sbs=1 to the itcl4.0.3rc0 release. In my test program, I also explicitly [package require]d itcl 4.0.3 before itk and printed out the [package ifneeded] to make sure that's what it was actually using. As far as I can tell it should be using that patch, but I still get a segfault. dgp added on 2015-02-18 16:08:29: Thanks for the additional testing. I've not been able to reproduce any segfault with the submitted test script. Since you report that you can get one fairly reliably, I suspect we'll see more reports of the issue continue to come in. Hopefully one will enable me to reproduce and work on the problem. For now I'll set this aside, pending more info. dgp added on 2017-07-06 20:17:46: This was probably related to Itcl Bug https://core.tcl.tk/itcl/tktview?name=19fa152b36 That's fixed in the latest branches of Itcl, 4.0.6 and 4.1.0 Suspect this is fixed now too. |