Closed Bug 124628 Opened 23 years ago Closed 21 years ago

Allow an nsresult argument to NS_NEWXPCOM

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
Future

People

(Reporter: sicking, Assigned: dougt)

References

()

Details

I've a couple of times needed to do initialization in the ctor that can fail, for example instancing member-vars. To do this i figured i could add an |nsresult* rv| argument to the ctor and return the errorcode there. However if I can no longer use the NS_NEWXPCOM to instaciate the class and so I loose refcnt tracing. So I was thinking that we could maybe add a NS_NEWXPCOM_WITH_RESULT macro that allows a nsresult* argument to the ctor. I'd happily produce a patch for this if you think it's a good idea. The alternative is to add an Init-function to the class and call that right after instancing, however this adds uglyness to the implementation since it breaks up the ctor into two functions
How about a macro which is NS_NEWXPCOM_INIT which takes a init function name? Attach a patch, please.
Target Milestone: --- → mozilla1.2
but that wouldn't solve the main problem, that i have to split up the initialization in two functions; ctor and Init
attach a patch which will better describe what you want to do.
Target Milestone: mozilla1.2alpha → Future
nevermind I don't think this is really a good idea any more
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.