David Chisnall wrote:
> Here’s a little test program that finds out:
Thanks, that was really helpful. And it's not surprising that on
GNUstep your test program causes infinite recursion here:
> 2018-02-20 14:46:39.917 a.out[85231:11731363] -floatValue called
> The correct fix is probably:
[...]
> And apply similar fixes to the other *Value methods in NSCell.
I followed this advice and now another infinite recursion occurs:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6096e79 in _int_malloc (av=av@entry=0x7ffff63c7c20 <main_arena>,
bytes=bytes@entry=32) at malloc.c:3575
3575 malloc.c: Няма такъв файл или директория.
(gdb) bt
#0 0x00007ffff6096e79 in _int_malloc (av=av@entry=0x7ffff63c7c20 <main_arena>,
bytes=bytes@entry=32) at malloc.c:3575
#1 0x00007ffff6098dc3 in __GI___libc_malloc (bytes=32) at malloc.c:3051
#2 0x00007ffff70bbd4c in default_malloc (zone=<optimized out>, size=<optimized
out>) at NSZone.m:122
#3 0x00007ffff70107d8 in NSAllocateObject (aClass=0x7ffff74e0a60
<_OBJC_Class_NSDoubleNumber>, extraBytes=extraBytes@entry=0, zone=
0x7ffff7545460 <default_zone>, zone@entry=0x0) at NSObject.m:782
#4 0x00007ffff70074d0 in +[NSNumber numberWithDouble:] (self=<optimized out>,
_cmd=<optimized out>, aValue=<optimized out>) at NSNumber.m:948
#5 0x00007ffff77d4d0f in -[NSCell setDoubleValue:] (self=0x5555562f15b0,
_cmd=<optimized out>, aDouble=0) at NSCell.m:410
#6 0x000055555555dc8b in -[SMDoubleSliderCell setDoubleHiValue:]
(self=0x5555562f15b0, _cmd=<optimized out>, aDouble=0) at
SMDoubleSliderCell.m:487
#7 0x000055555555dc8b in -[SMDoubleSliderCell setDoubleHiValue:]
(self=0x5555562f15b0, _cmd=<optimized out>, aDouble=0) at
SMDoubleSliderCell.m:487
...
NSSliderCell's -init calls -setDoubleValue: which in turn calls
-setDoubleHiValue: and at the end it calls the superclass'
-setDoubleValue:. NSCell's -setDoubleValue: calls -setObjectValue:
but it's the SMDoubleSliderCell's method that is used which resorts to
-setDoubleValue: again (calling [super setDoubleValue:]).
I turned NSCell's -setObjectValue: to a private method and changed all
-set*Value: methods to use it. My test program doesn't crash now and
I can see the two knobs. Movement is awkward (no sliding effect) and
if I click on the first knob the second one disappears. But at least
there is some hope. There's still something fishy going on but
unfortunately I don't understand the code well enough to figure it
out.
Is it a problem that SMDoubleSliderCell overrides both -drawKnob: and
-drawKnob?
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep