WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
100237
IconDatabase: Properly clean up on destruction
https://bugs.webkit.org/show_bug.cgi?id=100237
Summary
IconDatabase: Properly clean up on destruction
Jocelyn Turcotte
Reported
2012-10-24 05:20:21 PDT
IconDatabase: Properly cleanup on destruction
Attachments
Patch
(2.74 KB, patch)
2012-10-24 05:27 PDT
,
Jocelyn Turcotte
no flags
Details
Formatted Diff
Diff
Patch
(2.61 KB, patch)
2012-10-24 10:42 PDT
,
Jocelyn Turcotte
no flags
Details
Formatted Diff
Diff
Patch
(2.75 KB, patch)
2012-10-25 09:47 PDT
,
Jocelyn Turcotte
beidson
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Jocelyn Turcotte
Comment 1
2012-10-24 05:27:39 PDT
Created
attachment 170373
[details]
Patch
Brady Eidson
Comment 2
2012-10-24 08:50:27 PDT
Comment on
attachment 170373
[details]
Patch We don't clean up C++ objects on termination in WebCore/WebKit. The IconDatabase should be explicitly closed by each port in a way that makes sense for them.
Brady Eidson
Comment 3
2012-10-24 08:52:52 PDT
(In reply to
comment #2
)
> (From update of
attachment 170373
[details]
) > We don't clean up C++ objects on termination in WebCore/WebKit. > > The IconDatabase should be explicitly closed by each port in a way that makes sense for them.
To further elaborate, the WKIconDatabaseClose() API exists to explicitly do this from the embedding application. On Mac, we want this to be explicit and not automatic. If you want it to be automatic in your port then you should put an explicit ::close() call in your port's shutdown code (assuming there is any, which there probably is...!)
Jocelyn Turcotte
Comment 4
2012-10-24 10:42:51 PDT
Created
attachment 170427
[details]
Patch Ok, good to know. Tell me how this looks now, I'll do the close() in WebContext::platformInvalidateContext in another patch.
Brady Eidson
Comment 5
2012-10-24 10:56:41 PDT
Comment on
attachment 170427
[details]
Patch You should only explicitly call ::close() on the WebCore::IconDatabase. You should not actually cause it to be destroyed. We don't run destructors at exit time.
Brady Eidson
Comment 6
2012-10-24 10:57:31 PDT
I would suggest that in your platform specific code that is run at shut down, you simply call WebIconDatabase::close()
Jocelyn Turcotte
Comment 7
2012-10-25 03:26:02 PDT
(In reply to
comment #5
)
> We don't run destructors at exit time.
The thing is that I want to allow the WebContext to be destroyed after the application destroys the last page and continues running. It's most likely not a full web browser in that case, but we still allow using the icon database. Since WebIconDatabase is refcounted and keeps the WebCore::IconDatabase in an OwnPtr, it will be destroyed with the WebContext which usually owns the last reference to the WebIconDatabase. I might be wrong somewhere so please correct me, but the only way I can see the IconDatabase not being destroyed is if the client code is expected to keep a reference outside WebKit to the WebIconDatabase or the WebContext until shutdown, and I can't enforce this. Another example is in WebIconDatabase::setDatabasePath where m_iconDatabaseImpl.clear() is called. This will also destroy the WebCore::IconDatabase and the assert will be hit.
Brady Eidson
Comment 8
2012-10-25 08:58:41 PDT
(In reply to
comment #7
)
> (In reply to
comment #5
) > > We don't run destructors at exit time. > > The thing is that I want to allow the WebContext to be destroyed after the application destroys the last page and continues running. It's most likely not a full web browser in that case, but we still allow using the icon database. > > Since WebIconDatabase is refcounted and keeps the WebCore::IconDatabase in an OwnPtr, it will be destroyed with the WebContext which usually owns the last reference to the WebIconDatabase. > I might be wrong somewhere so please correct me, but the only way I can see the IconDatabase not being destroyed is if the client code is expected to keep a reference outside WebKit to the WebIconDatabase or the WebContext until shutdown, and I can't enforce this. > > Another example is in WebIconDatabase::setDatabasePath where m_iconDatabaseImpl.clear() is called. This will also destroy the WebCore::IconDatabase and the assert will be hit.
I see... interesting. In that case, the existing ASSERT is definitely invalid. But then we want to more explicitly enforce the "destruction shouldn't do meaningful cleanup" rule. Could you change the ASSERT in the IconDatabase destructor to be: ASSERT(!isOpen())
Jocelyn Turcotte
Comment 9
2012-10-25 09:47:24 PDT
Created
attachment 170676
[details]
Patch Sounds good.
Jocelyn Turcotte
Comment 10
2012-11-01 07:00:03 PDT
Brady, would you have a minute to check the last patch?
Jocelyn Turcotte
Comment 11
2012-11-01 08:18:10 PDT
Committed
r133175
: <
http://trac.webkit.org/changeset/133175
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug