Closed
Bug 38776
Opened 25 years ago
Closed 25 years ago
Potential Leak: OleUninitialize() isn't called for each OleInitialize()
Categories
(SeaMonkey :: UI Design, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
M16
People
(Reporter: deanis74, Assigned: rods)
Details
(Keywords: memory-leak)
nsWindow::StandardWindowCreate() calls OleInitialize() and sets gOLEInited =
TRUE. For each of these calls to OleInitialize, there should be a matching call
to OleUnitialize.
To quote from MSDN
(http://msdn.microsoft.com/library/psdk/com/ofn_ol2z_13vp.htm):
"The OleInitialize and OleUninitialize calls must be balanced — if there are
multiple calls to the OleInitialize function, there must be the same number of
calls to OleUninitialize: Only the OleUninitialize call corresponding to the
OleInitialize call that actually initialized the library can close it."
Comment 1•25 years ago
|
||
jrgm, would you know how to narrow this one down? thx!
Whoops. I'm dropping the status down to normal because I somehow missed that
this is called only if gOLEInited is not TRUE. But it still needs to be cleaned
up somewhere, probably on app exit.
Severity: major → normal
Comment 3•25 years ago
|
||
My best guess from lxr is that this is code that rods has worked with at least.
However, I'm not going to guess whether this is a problem, or what the solution
would be. Wanna propose a patch, Dean?
Assignee: don → rods
There's a couple of things that can be done. One is to call OleUnitialize() in
nsWindow::Destroy() and reset the gOleInited flag, but that would then cause
OleInitialize to be called with the next StandardWindowCreate(). This would
make sure that each OleInit was paired with an OleUninit, but it would overdo it
on the calls to OleInit.
The better way to do it would be when the app shuts down completely. If
gOleInited == TRUE, call OleUnitialize() and set gOleInited = FALSE. But I'm
not sure where in the code this would be done.
Assignee | ||
Comment 5•25 years ago
|
||
gOLEInited is a global variable and OleInitialize is only called once.
marking invalid
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Assignee | ||
Comment 7•25 years ago
|
||
OleUninitialize is not being called
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
I realize that. My question is why isn't it being called?
Sorry Rod. I missed that you re-opened the bug with your last comment.
Assignee | ||
Comment 10•25 years ago
|
||
it now get properly inited and uninitied - fixed
Status: REOPENED → RESOLVED
Closed: 25 years ago → 25 years ago
Resolution: --- → FIXED
Target Milestone: --- → M16
Reporter | ||
Comment 11•25 years ago
|
||
Does OleRegisterMgr::~OleRegisterMgr() get called on shutdown? Is there a way
that it can reset the gOleInited variable?
Assignee | ||
Comment 12•25 years ago
|
||
Because it is a global object it gets created very early on and then gets
destroyed at the very end. I could have put a counter in nsWindow to count the
number of constructs and destructs but decided that this approach was safer.
Reporter | ||
Comment 13•25 years ago
|
||
Well then there's still a little problem. OleInitialize will get called twice
and OleUninitialize only once. The first time OleInit gets called is in
OleRegisterMgr::OleRegisterMgr() and the second time is in the first
nsWindow::StandardWindowCreate(). A suggestion is to get rid of the call in
StandardWindowCreate() if OleRegisterMgr is always created very early on.
Comment 14•25 years ago
|
||
> second time is in the first nsWindow::StandardWindowCreate()
That was removed in the same checkin that added the new class, no? There is only
one call to OleInitialize possible.
Assignee | ||
Comment 15•25 years ago
|
||
Yes, it was removed and now there is only one call to each
Reporter | ||
Comment 16•25 years ago
|
||
Stupid me. Asked before I look. Apologies.
Assignee | ||
Comment 18•25 years ago
|
||
No, problem. I didn't realize we were never doing the uninit, thanks for the
help.
Updated•20 years ago
|
Product: Core → Mozilla Application Suite
You need to log in
before you can comment on or make changes to this bug.
Description
•