• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Bizarre AppKit behavior.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bizarre AppKit behavior.


  • Subject: Bizarre AppKit behavior.
  • From: "Emanuele Vulcano" <email@hidden>
  • Date: Wed, 13 Dec 2006 14:04:14 +0100

OK, what I do in Afloat is far from bizarre, but this I really don't get why.

I'm debugging a problem that arises in the -beginSeethru: method below.

- (IBAction) beginSeethru:(id) sender {
   if (doingSeethru) return;
   doingSeethru = YES;

   NSEnumerator* enu = [[[AfloatImplementation sharedInstance]
windows] objectEnumerator];
   id wnd;

   while (wnd = [enu nextObject]) {
       NSMutableDictionary* info = [self infoForWindow:wnd];

       BOOL wasOverlay = [wnd overlayWindow];
       [info setObject:[NSNumber numberWithBool:wasOverlay]
forKey:@"AfloatSeethruOldOverlayValue"];
       [wnd setOverlayWindow:YES];

       float oldAlpha = [wnd alphaValue];
       [info setObject:[NSNumber numberWithFloat:oldAlpha]
forKey:@"AfloatSeethruOldAlphaValue"];
       [wnd setAlphaValue:0.1];
   }
}

When I attach an instance of Safari where my code is in, and step to
the line past float oldAlpha = ...;, I see that the value returned by
the method is wrong (it's around 0.4 while it should be 1.0). Peeking
with the debugger confirms this:

(gdb) po wnd
<NSWindow: 0x5d1550>
(gdb) p (float) [wnd alphaValue]
$1 = 0.400000006
(gdb) p (void*) [wnd alphaValue]
$2 = (void *) 0x5d1550

It returns self! (I found out when I forgot a po rather than a p and a
<NSWindow> description came rather than an error.)
This seems just like the behavior objc_msgSend has when nil is
messaged, in that it returns $r3 (which happens to be nil). However,
this is not nil.

Anybody has any clue?

- Emanuele "∞" Vulcano
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Converting wav to mp3
  • Next by Date: Cocoa UI
  • Previous by thread: Re: new uint8_t
  • Next by thread: Cocoa UI
  • Index(es):
    • Date
    • Thread