Tk Source Code

View Ticket
Login
Ticket UUID: 48f5da841df2a45749880bdafb276521e67e825b
Title: mac_styles branch crash when spinbox does not have enough room
Type: Bug Version:
Submitter: nab Created on: 2020-01-06 09:39:55
Subsystem: 66. Aqua Window Operations Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2020-01-18 19:29:23
Resolution: Fixed Closed By: marc_culler
    Closed on: 2020-01-18 19:29:23
Description:
Hi Marc,
using mac_styles branch.

the following script is crashing wish when you resize the window (going smaller)

best regards,
nicolas

package require Tk
package require Ttk

set lMaster [ttk::frame .f]

ttk::label $lMaster.bp -text "longTextBeforeTheSpinbox"
ttk::label $lMaster.bm -text "happy new year"
ttk::spinbox $lMaster.sp  -from 1 -to 100 -increment 1 -width 3 -font {TkTextFont 18}

grid $lMaster.bp $lMaster.sp $lMaster.bm -sticky nsew  -row 0 -rowspan 1  -padx 1 -pady 1 -ipady 1
grid $lMaster -sticky news

grid columnconfigure $lMaster all -weight 1
grid columnconfigure . all -weight 1
grid rowconfigure $lMaster all -weight 1
grid rowconfigure . all -weight 1
User Comments: marc_culler (claiming to be Marc Culler) added on 2020-01-18 19:29:23:
This fix has been merged into the mac_styles branch.  I will close the ticket.

Takamoto added on 2020-01-14 09:42:37:
@nab thank you for pointing to this workaround. I have to admit that the crash happens in my allocation only for one particular pack/unpack (with probably some destroy nested), and depending on previous packing/unpacking at a higher level of the widget hierarchy (this is the reason a can not reproduce it in a simple script, since I still could not figure out that triggers the difference crash/non crash for the same operation). I need to investigate better the causes.

@everybody: I do not know if general suggestions are welcomed here (maybe another thread?). I like the new changes, and these are just small differences I noted to native widget, therefore not important.

ttkBrowseEntry
- the arrow icon does not match macOS, it should be a double arrow to mimic the new behaviour
- when selected, the border of the native widget is not highlighted
- the container of the native widget is rectangular, but the corners  are rounded

border highlight
- the corners in native widgets are always rounded (even if the container is not rounded)
- on my computer, the blue of Tk is lighter than the blue of original widget (Mojave, maybe different in Catalina)

Thank you for the great work!

nab added on 2020-01-13 08:10:16:
sorry for double posts...
I thought the first has failed...

++

nab added on 2020-01-13 08:09:05:
Hi,
using mac_style branch I had to use a lot the following syntax:
after 1 [list doWhateverYouWant]

for stuff to be smooth.

also I had to add a delay mechanism for creation/destroy of topLevels for not my app to crash.
something like that:
proc nsWin_sleep {ms namespace} {
    namespace upvar $namespace nsWin_sleepV localnsWin_sleepV

    after $ms {set localnsWin_sleepV 1}
    vwait localnsWin_sleepV

}
proc win_modifyDelay {} {
    nsWin_sleep 100 Dlightmain
}

proc win_deiconifySequence {win} {
    if {[tk windowingsystem] eq {aqua} && $::tcl_platform(osVersion) >= 18} {
        update idletasks
        ::tk::unsupported::MacWindowStyle appearance $win darkaqua
    }

    
    wm deiconify $win
    if {[tk windowingsystem] eq {aqua}} {
      win_modifyDelay
    }

}

proc win_deleteSequence {delay win} {
    destroy $win
    if {[tk windowingsystem] eq {aqua}} {
        nsWin_sleep $delay Dlightmain
        update idletasks
    }
}


hope it helps.
++

nab added on 2020-01-13 08:05:52:
@Takamoto,
Hi,
while using mac_styles branch I had to write:
after 1 [list doDesiredEval args]
a lot in order for stuff to be smooth and not crashing.

also for toplevel creation/destroy I had to use a delay mechanism for not my app to crash.
something like that:

proc nsWin_sleep {ms namespace} {
    namespace upvar $namespace nsWin_sleepV localnsWin_sleepV

    after $ms {set localnsWin_sleepV 1}
    vwait localnsWin_sleepV

}
proc win_modifyDelay {} {
    nsWin_sleep 100 Dlightmain
}

proc win_deiconifySequence {win} {
    if {[tk windowingsystem] eq {aqua} && $::tcl_platform(osVersion) >= 18} {
        update idletasks
        ::tk::unsupported::MacWindowStyle appearance $win darkaqua
    }
    
    wm deiconify $win
    if {[tk windowingsystem] eq {aqua}} {
      win_modifyDelay
    }

}

proc win_deleteSequence {delay win} {
    destroy $win
    if {[tk windowingsystem] eq {aqua}} {
        nsWin_sleep $delay Dlightmain
        update idletasks
    }
}
 

hope this helps.
++

Takamoto added on 2020-01-12 21:18:08:
Using the Mac_styles branch with my quite complex UI, crashes with:

Illegal instruction: 4

when packing a ttkFrame containing a ttkEntry widget. 

Unfortunately I could not create a minimalist code to reproduce the issue. I have a window with some nested frames (<10). A previously created ttkFrame containing a ttkEntry, when packed, makes the UI crashing. 

Attached, the crash report from macOS (crash report_Takamoto), in the hope that it can shed some light.

nab added on 2020-01-10 08:24:51:
@Takamoto,
Hi, this is the mac_style branch:
https://core.tcl-lang.org/tk/info/71c568e9d8fc449a

++

Takamoto added on 2020-01-10 07:42:15:
Hello everybody,

can you briefly point me to the right link of the Tk I need to compile in order to have the new ttk widget styles? And if I have to set something particular to use them? I would like to test them. The reason is that I will soon start to - manually - change the appearance of our UI (buttons, and so on) and probably many things that I need to achieve will be already standard with the new ttk widget styles. I would be happy to report any issue, if any.

Cheers

marc_culler (claiming to be Marc Culler) added on 2020-01-07 14:35:18:
The plan is to propose a TIP which includes the new mac image type and the
new ttk widget styles which are implemented in the mac_styles branch.
Thanks to your testing @nab I am fairly confident that these styles are now
mostly working.  I think it would be good to have some demo code which
demonstrates the styles.  That is a bit involved because you want to have
two versions of the demo to compare -- one written in Tk and one written
in objective C using XCode.  But that is fairly far along at this point.

nab added on 2020-01-07 05:54:32:
Hi Marc, François,
fix works as expected, thank you !!

would you mind telling me what's your plan regarding mac_styles branch?

best regards,
nicolas

marc_culler (claiming to be Marc Culler) added on 2020-01-06 21:44:12:
@nab: Thank you for the bug report.  (It's nice to get a simple demo script!)

@françois: Thank you for the crash report. (With symbols!)

I think this is now fixed in the bug-48f5da841d branch.

fvogel added on 2020-01-06 18:52:02:

Confirmed (on Catalina). It crashes in mac_styles branch (but not in core-8-6-branch) with:

 Illegal instruction: 4

I'm attaching the crash log.


Attachments: