XPCOMGC/Stack Pointers
< XPCOMGC
Jump to navigation
Jump to search
Automatic rewriting spec for XPCOMGC:
Detect every instance of nsCOMPtr that is used as a stack variable, and rewrite it to be a raw pointer. Also remove use of getter_AddRefs with these objects.
e.g.
nsFoo::Function(nsISupports* gah)
{
- nsCOMPtr<nsIBar> bar;
+ nsIBar* bar;
- nsCOMPtr<nsIBaz> gahbaz = do_QueryInterface(gah);
+ nsIBaz* gahbaz = do_QueryInterface(gah);
- nsresult rv = gahbaz->GetBar(getter_AddRefs(bar));
+ nsresult rv = gahbaz->GetBar(&bar);
}