Bug 210710 - REGRESSION (r244091): Leak of TaskStateChangedCallbackType due to missing -dealloc
Summary: REGRESSION (r244091): Leak of TaskStateChangedCallbackType due to missing -de...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on: 196659
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-18 19:26 PDT by David Kilzer (:ddkilzer)
Modified: 2020-04-19 20:46 PDT (History)
4 users (show)

See Also:


Attachments
Patch v1 (1.66 KB, patch)
2020-04-18 19:36 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch for landing (1.64 KB, patch)
2020-04-19 19:08 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2020-04-18 19:26:57 PDT
Leak of TaskStateChangedCallbackType due to missing -dealloc.

Found by clang static analyzer:

'WKProcessTaskStateObserverDelegate' lacks a 'dealloc' instance method but must release '_taskStateChangedCallback'

Regressed with the fix for Bug 196659 in r244091:

Bug 196659: [Cocoa] Awaken UIProcess if WebContent process is awakened from suspensions unexpectedly.
<https://bugs.webkit.org/show_bug.cgi?id=196659>
<rdar://problem/49745738>
<https://trac.webkit.org/r244091>
Comment 1 Radar WebKit Bug Importer 2020-04-18 19:27:31 PDT
<rdar://problem/61992856>
Comment 2 David Kilzer (:ddkilzer) 2020-04-18 19:36:02 PDT
Created attachment 396887 [details]
Patch v1
Comment 3 David Kilzer (:ddkilzer) 2020-04-18 19:37:25 PDT
Comment on attachment 396887 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396887&action=review

> Source/WebKit/Shared/Cocoa/ProcessTaskStateObserver.mm:46
> +- (void)dealloc

I chose to implement dealloc because using RetainPtr<> would require an instance variable and a custom getter (and maybe a setter).

When switching to ARC, we simply delete the -dealloc method and the @property will work as expected.
Comment 4 Darin Adler 2020-04-19 18:07:46 PDT
Comment on attachment 396887 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=396887&action=review

> Source/WebKit/Shared/Cocoa/ProcessTaskStateObserver.mm:49
> +    _taskStateChangedCallback = nil;

Seems unnecessary to set things to nil in dealloc.
Comment 5 David Kilzer (:ddkilzer) 2020-04-19 19:08:06 PDT
Created attachment 396935 [details]
Patch for landing
Comment 6 EWS 2020-04-19 20:46:44 PDT
Committed r260348: <https://trac.webkit.org/changeset/260348>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 396935 [details].