[Webkit-unassigned] [Bug 56507] New: DeviceOrientationClient leak

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 16 17:20:08 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=56507

           Summary: DeviceOrientationClient leak
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: joepeck at webkit.org
                CC: ddkilzer at webkit.org, steveblock at google.com


On chromium the lifetime of a DeviceOrientationClient seems to be
managed by the WebViewImpl, because its proxy is an OwnPtr.

On platform/mac it looks like the lifetime of a DeviceOrientationClient is
a little crazier:

  1. Allocated somewhere in client code.
  2. Setup deviceOrientationClient in PageClient and pass to Page constructor
    => controller uses it during the Page's lifetime
  3. Page is destroyed, Controller is destroyed, Controller calls
      deviceOrientationControllerDestroyed on the Client
  4. Deallocate when receiving deviceOrientationControllerDestroyed.

The controller is necessary to call deviceOrientationControllerDestroyed
and destroy the DeviceOrientationClient. However, the controller
might not even be created in Page's constructor:

  , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? new DeviceOrientationController(this, pageClients.deviceOrientationClient) : 0)

I'm just eyeballing this but I think there is a leak if this feature is
disabled at runtime. The DeviceOrientationClient would be created:

  #if ENABLE(DEVICE_ORIENTATION)
      pageClients.deviceOrientationClient = new WebDeviceOrientationClient(self);
  #endif
      _private->page = new Page(pageClients); 

But no Controller would adopt it, and therefore no-one ever tells
this DeviceOrientationClient instance to delete itself.

The EmptyClient implementation also doesn't delete itself. That
looks expected since its a static local though.

This seems messy. It would be much nicer to RefCount the DeviceOrientationClient
like other PageClients. Chromium might complicate this because they already
use OwnPtr for their proxy.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list