Closed
Bug 635476
Opened 14 years ago
Closed 12 years ago
nsIdleService isupports inheritance is fancy
Categories
(Core :: Widget, defect)
Core
Widget
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: mak, Unassigned)
Details
I'm not going through all the details, just look at this:
NS_IMPL_ISUPPORTS2(nsIdleServiceWin, nsIIdleService, nsIdleService)
plus:
- inherited classes don't need to implement isupports, the base class can
- the base class destructor is not virtual
Also, we keep doing crazy things like:
nsCOMPtr<nsIdleService> mIdleService;
mIdleService = do_GetService("@mozilla.org/widget/idleservice;1");
should probably be
nsCOMPtr<nsIIdleService> svc =
do_GetService("@mozilla.org/widget/idleservice;1");
if (svc)
mIdleService = static_cast<nsIdleService*>(svc.get());
this still sucks (see also bug 520933) but at least has more sense then a COMPtr to something that is not an interface. Ideally the idl could be changed to include the method we keep calling from nsIdleService, then we could use a COMPtr safely.
This is a mess.
Not to imply that the behavior here is sane (I haven't looked at the source), but it is useful if derived classes NS_DECL_ISUPPORTS_INHERITED and then NS_IMPL_[ADDREF|RELEASE]_INHERITED because if they don't only the base class shows up in leak logs.
Reporter | ||
Comment 2•12 years ago
|
||
Looks like the various cleanups in this service have fixed all of my complains (inheriting is proper, no more wrong ptrs), marking as wfm.
Assignee: mak77 → nobody
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•