getting rid of anObsoleteOBNotifier

Colin Putney cputney at wiresong.ca
Wed Oct 20 14:44:55 UTC 2004


Jeff Sparkes wrote:
> It seems that one of the upgrade to Omnibrowser left a registered event behind, so I get
> error about AnObsoleteOBNotifier>>event:
> 
> I'm pretty sure it's because the OBNotifier class was renamed to OBNotification, so there's now no receiver.   How can I unregister this event?  I've spent time poking around in SystemEventManager, WeakMessageSend, and WeakActionSend and actionMaps, but I still haven't found the magic way to unregister this event. The intersection between obsolete classes and events is hurting my brain.

No, OBNotifier was my attempt at a simple way to handle updating the 
browser when the system is changed by something other than that browser. 
It had nothing to do with OBNotification.

> The best solution I found was to explore "Smalltalk obsoleteClasses".  It turns out that anObsoleteNotifier was at: 29, so I did "(Smalltalk obsoleteClasses at: 29) becomeForward: OBNotification class", which seems to have done the trick.

I'm surprised this hasn't caused you any problems. If you find yourself 
in this situation again, the best way to fix it is to send #unregister 
to the instance of OBNotifier. For this image, I think you want 
something like the following. I don't have a Squeak image handy, so I 
can't check this code...

SystemChangeNotifier uniqueInstance noMoreNotificationsFor: 
theObsoleteOBNotifer.

> Is this a general technique to use after renaming classes?

In general, you shouldn't need to do this kind of thing. Renaming a 
class should "just work." (Although this was a case of removing a 
class.) This was a pretty ugly hack that I didn't clean up properly when 
I took it out. I'll add the clean up code to the OB installer.

Thanks for the heads up,

Colin




More information about the Squeak-dev mailing list