Closed Bug 485834 Opened 15 years ago Closed 15 years ago

ObserverService shouldn't recurse infinitely for stupid consumers

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

Details

(Keywords: crash)

Attachments

(1 file)

So, bug 325392 shows an example of a stupid consumer.

NS_IMPL_ISUPPORTS1(nsBroken, nsIObserver)

nsBroken::nsBroken() {
  nsCOMPtr<nsIObserverService>
    os(do_GetService("@mozilla.org/observer-service;1"));
  os->AddObserver(this, "stupid", PR_FALSE);
}

nsBroken::~nsBroken() {
  nsCOMPtr<nsIObserverService>
    os(do_GetService("@mozilla.org/observer-service;1"));
  os->RemoveObserver(this, "stupid");
}

NS_IMETHODIMP
nsBroken::Observe(
  nsISupports*     subject,
  const char*      topic,
  const PRUnichar* data_unicode)
{
  return NS_OK;
}
Attachment #369926 - Flags: review?(ted.mielczarek)
Comment on attachment 369926 [details] [diff] [review]
protect against stupidity

I am not qualified to review this.
Attachment #369926 - Flags: review?(ted.mielczarek)
dougt maybe?
Comment on attachment 369926 [details] [diff] [review]
protect against stupidity

add a comment to the reason you need the death grip.
Attachment #369926 - Flags: review+
Whiteboard: [timeless: need patch addressing comment 3]
http://hg.mozilla.org/mozilla-central/rev/9b612b23ae16
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [timeless: need patch addressing comment 3]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: