• 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
Re: Questions regarding release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions regarding release


  • Subject: Re: Questions regarding release
  • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
  • Date: Thu, 26 Sep 2019 11:25:28 +0200

>>
>>> Is the IOObjectRelease() right or wrong ?
>>      I’m not entirely sure since I can’t find the docs for
>> IOServicePortFromCGDisplayID.
>
> Given that the code fragment shows it as a message being sent to “self”, this
> looks like Gabriel’s own method. By the standard Obj-C clang naming
> conventions, this should return a non-owning (+0) reference, so it should not
> be released without being explicitly retained.
>
> My guess is that it actually returns a +1 reference, but uses a non-standard
> naming convention. In that case, the code is correct as written (although
> unclear because it doesn’t follow the naming conventions).
>

Sorry again for the incomplete question.

This is what my function IOServicePortFromCGDisplayID essentially does:

- (io_service_t) IOServicePortFromCGDisplayID: (CGDirectDisplayID) displayID
{
    io_iterator_t iter;
    io_service_t serv, servicePort = 0;
   kern_return_t err = IOServiceGetMatchingServices( kIOMasterPortDefault,
matching, & iter );

    while ( (serv = IOIteratorNext(iter)) != 0 )
    {
       ... check some criteria
       if ( it is not the right display )
         continue;

        servicePort = serv;
        CFRelease(displayInfo);
        break;
    }

    IOObjectRelease(iter);
    return servicePort;
}

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

References: 
 >Questions regarding release (From: Gabriel Zachmann via Cocoa-dev <email@hidden>)
 >Re: Questions regarding release (From: Rob Petrovec via Cocoa-dev <email@hidden>)
 >Re: Questions regarding release (From: Quincey Morris via Cocoa-dev <email@hidden>)

  • Prev by Date: Re: Questions regarding release
  • Next by Date: Re: Questions regarding release
  • Previous by thread: Re: Questions regarding release
  • Next by thread: Re: Questions regarding release
  • Index(es):
    • Date
    • Thread