discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GORM and NSCollectionView


From: Fred Kiefer
Subject: Re: GORM and NSCollectionView
Date: Thu, 05 Mar 2015 22:58:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

I used gdb to get the full stack trace form Gorm. The problem happens
when line 161 in NSCollectionView.m tries to get the item 0 while there
isn't any item in the subview list.

The issue that causes this strange behaviour seem to be the MIN macro.
I added the following line before the loop:

  NSLog(@"first %d last %d %d %d %d", firstIndexInRect, lastIndexInRect,
[_items count] - 1, [self _indexAtPoint: oppositeOrigin], MIN(-1, 12));

This prints:

2015-03-05 22:40:31.307 Gorm[2624:2624] first 0 last 12 -1 12 -1

lastIndexInRect is 12 while it should be -1, but doing the same MIN call
with constants gives the correct result. When I extract the count to a
variable first and use that it also works. This definitely seems to be
compiler magic, most likely it gets the type of the count method as
NSUInteger and uses [_items count] - 1 also as unsigned.

I fixed this and hope that your application now works on GNUstep.

Fred



Am 03.03.2015 um 13:30 schrieb Alessandro Sangiuliano:
> Hello, some days ago I wrote a little App to practice with
> NSCollectionView.
> I wrote it on OS X 10.6.8 XCode 3.2.2 and the relative IB; I ported the
> App on GNUstep and when I try to open the nib or the xib file with GORM,
> it is saying that:
> 
> "Problem Loading
> Failed to load file. Exception: Index 0 is out of range 0 (in
> 'objectAtIndex:')
> "
> 
> Last GORM update from the svn: Today.
> 
> I need this little App on GNUstep because I'll switch my little Calendar
> App to NSCollectionView as soon as I can and I'd like to have it on
> GNUstep, because I need specifically on GNUstep.
> 
> However, if I try to run the App without modify the nib file, it runs, but:
> 
> 1) If I try to resize the window, it becomes totally black and the App
> is not usable.
> 2) If i click on the button "Add Student", it adds nothing. (It should
> add a view)
> 
> To implement the GUI, I used IB facilities for Cocoa bindings.
> 
> On OS X (10.6.8 and 10.10 too) the App behaves as expected.
> 
> The code is on github if you want to give a look. It's possible to try
> it with XCode (3.2.2, and probably it also works for XCode 6 because I
> have the same implementation on 10.10 and I did not remember differences
> on the implementation) or with GNUstep.
> 
> https://github.com/AlessandroSangiuliano/NSCollectionView.git
> 
> Best regards,
> Alex.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]