• 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: Major Bug in Cocoa (With sample Code!!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Major Bug in Cocoa (With sample Code!!)


  • Subject: Re: Major Bug in Cocoa (With sample Code!!)
  • From: Greg Titus <email@hidden>
  • Date: Sat, 4 Aug 2001 13:52:14 -0700

On Saturday, August 4, 2001, at 01:34 PM, Jens Baumeister wrote:
>
> Here's a quick and dirty fix for your problem. Add a category like this:
[...]

> If you change your call from invokeWithTarget to newInvokeWithTarget ,
> the retain count will stay the same. Needless to say, this is not an
> ideal solution and you should still report the bug to Apple.
>
> Questio: Would it be possible to name the category method
> invokeWithTarget and still somehow access the original invokeWithTarget
> from within the category - the way a call to super works from within a
> subclass?
>
> That would make the whole thing more elegant, because you wouldn't need
> to change the code outside the category.

You can do it by modifying the Obj-C runtime directly and replacing the
existing implementation pointer with your new implementation, saving the
old implementation pointer and calling it directly inside the new
implementation.

There are a couple bug fixes similar to yours in OmniFoundation which do
this - you can look at them for examples. OmniBase includes a function
OBReplaceMethodImplementationWithSelector() to do the switch (just
search for that function).

-Greg


  • Prev by Date: Re: Programatically Designing a GUI
  • Next by Date: Re: Major Bug in Cocoa (With sample Code!!)
  • Previous by thread: Major Bug in Cocoa (With sample Code!!)
  • Next by thread: Re: Major Bug in Cocoa (With sample Code!!)
  • Index(es):
    • Date
    • Thread