Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Subclassing AppleMediaBay (bug report)



>AppleMediaBay's free method calls PMStop. The problem is that
PMInit is
>not called in the init method. Instead, it is called in initForPM,
which
>in turn is called by the start method. This means that in cases
where
>start is never called, PMStop is called without PMInit having ever
been
>called. And this is exactly what happens if you subclass
AppleMediaBay
>and out-match it. AppleMediaBay gets probed, but not started, and
then
>when it is freed PMStop gets called when it shouldn't be.

Shouldn't they simply be calling PMStop in stop instead of free? I thought
the implicit mechanism was that anything you did in start you undo in stop
and anything you do in init you undo in free...

-Kevin Elliott
Software Engineer
CharisMac Engineering

> ----------
> From: Ryan Rempel
> Sent: Thursday, March 7, 2002 21:23
> To: email@hidden
> Subject: Subclassing AppleMediaBay (bug report)
>
> There is a bug in AppleMediaBay which prevents it from being
> successfully subclassed. (Actually, it prevents any other driver that
> wants to match a media-bay device from working properly). Here's the bug
> report which I contributed to Radar (I am posting it here as well since
> Radar's web site hasn't been working for a while).
>
> -- Steps to Reproduce:
>
> Subclass AppleMediaBay with a higher IOProbeScore than AppleMediaBay has.
>
> -- Expected Results:
>
> The subclass will out-match AppleMediaBay, and AppleMediaBay will be
> free()'d gracefully.
>
> -- Actual Results:
>
> Kernel panic, with what appears to be an infinite recursion in
> OSCollection (error message is "corrupt stack" and the backtrace is
> repetitive and truncated).
>
> -- Diagnosis
>
> AppleMediaBay's free method calls PMStop. The problem is that PMInit is
> not called in the init method. Instead, it is called in initForPM, which
> in turn is called by the start method. This means that in cases where
> start is never called, PMStop is called without PMInit having ever been
> called. And this is exactly what happens if you subclass AppleMediaBay
> and out-match it. AppleMediaBay gets probed, but not started, and then
> when it is freed PMStop gets called when it shouldn't be.
>
> One solution would be to add an instance variable which would keep track
> of whether PMInit has been called. Then the free method could use that
> to decide whether to call PMStop.
> _______________________________________________
> darwin-development mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/darwin-development
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.