[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

aroben at apple.com aroben at apple.com
Wed Apr 7 23:23:51 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 9acbd55195b52ffc94eeea8b01b9a0fe7553d3b2
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 5 18:14:35 2009 +0000

    Make CFDictionaryPropertyBag::createInstance return a COMPtr
    
    I also cleaned up CFDictionaryPropertyBag's class declaration a little
    while I was at it.
    
    Part of <http://webkit.org/b/25294> <rdar://problem/6803127> All
    WebKit/win classes should return COMPtrs from their static constructor
    members
    
    Reviewed by Steve Falkenburg.
    
    * CFDictionaryPropertyBag.cpp:
    (CFDictionaryPropertyBag::CFDictionaryPropertyBag): Changed to
    initialize m_refCount to 0. m_refCount gets increased to 1 by
    createInstance.
    (CFDictionaryPropertyBag::createInstance): Changed to return a COMPtr.
    
    * CFDictionaryPropertyBag.h:
      - Updated copyright years
      - Fixed header guard to match current style
      - Replaced #include of CoreFoundation.h with forward-declaration of
        CFMutableDictionaryRef
      - Added #include of COMPtr.h
      - Fixed opening brace placement in class declaration
      - Made createInstance return a COMPtr
      - Made constructor/destructor private
      - Made QueryInterface and IPropertyBag functions private
      - Removed unnecessary parameter names and MIDL comments
    
    * WebCache.cpp:
    (WebCache::statistics): Updated for change to
    CFDictionaryPropertyBag::createInstance. Now uses releaseRef to place
    the IPropertyBag pointers into the s array.
    
    * WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebFrameLoaderClient::dispatchDidFailToStartPlugin):
    * WebDatabaseManager.cpp:
    (WebDatabaseManager::dispatchDidModifyDatabase):
    * WebFrame.cpp:
    (WebFrame::createJavaAppletWidget):
    Updated for change to CFDictionaryPropertyBag::createInstance.
    
    * WebHistory.cpp: Removed releaseUserInfo, which is no longer needed.
    That function was also doing an unnecessary call to setDictionary(0).
    (createUserInfoFromArray):
    (createUserInfoFromHistoryItem):
    Changed to return COMPtr.
    
    (WebHistory::loadFromURL): Updated for change to
    CFDictionaryPropertyBag::createInstance.
    
    (WebHistory::removeAllItems): Updated for change to
    CFDictionaryPropertyBag::createInstance, which fixed a leak! We had
    forgotten to call releaseUserInfo here.
    
    (WebHistory::removeItem):
    (WebHistory::addItem):
    (WebHistory::visitedURL):
    * WebIconDatabase.cpp:
    (postDidAddIconNotification):
    Updated for change to CFDictionaryPropertyBag::createInstance.
    
    * WebKitClassFactory.cpp:
    (releaseRefFromCreateInstance): Added this overloaded function
    template to abstract away the difference between createInstance
    functions that return a ref'd pointer and createInstance functions
    that return a COMPtr.
    (WebKitClassFactory::CreateInstance): Changed to use
    releaseRefFromCreateInstance.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50567 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/win/CFDictionaryPropertyBag.cpp b/WebKit/win/CFDictionaryPropertyBag.cpp
index 32457f1..f4fb5b3 100644
--- a/WebKit/win/CFDictionaryPropertyBag.cpp
+++ b/WebKit/win/CFDictionaryPropertyBag.cpp
@@ -33,7 +33,7 @@
 // CFDictionaryPropertyBag -----------------------------------------------
 
 CFDictionaryPropertyBag::CFDictionaryPropertyBag()
-: m_refCount(1)
+: m_refCount(0)
 {
     gClassCount++;
     gClassNameCount.add("CFDictionaryPropertyBag");
@@ -45,10 +45,9 @@ CFDictionaryPropertyBag::~CFDictionaryPropertyBag()
     gClassNameCount.remove("CFDictionaryPropertyBag");
 }
 
-CFDictionaryPropertyBag* CFDictionaryPropertyBag::createInstance()
+COMPtr<CFDictionaryPropertyBag> CFDictionaryPropertyBag::createInstance()
 {
-    CFDictionaryPropertyBag* instance = new CFDictionaryPropertyBag();
-    return instance;
+    return new CFDictionaryPropertyBag;
 }
 
 void CFDictionaryPropertyBag::setDictionary(CFMutableDictionaryRef dictionary)
diff --git a/WebKit/win/CFDictionaryPropertyBag.h b/WebKit/win/CFDictionaryPropertyBag.h
index 23763b3..3cac464 100644
--- a/WebKit/win/CFDictionaryPropertyBag.h
+++ b/WebKit/win/CFDictionaryPropertyBag.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,42 +23,37 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef CFDictionaryPropertyBag_H
-#define CFDictionaryPropertyBag_H
+#ifndef CFDictionaryPropertyBag_h
+#define CFDictionaryPropertyBag_h
 
-#include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/COMPtr.h>
 #include <wtf/RetainPtr.h>
 
-class CFDictionaryPropertyBag : public IPropertyBag
-{
-public:
-    static CFDictionaryPropertyBag* createInstance();
-protected:
-    CFDictionaryPropertyBag();
-    ~CFDictionaryPropertyBag();
+typedef struct __CFDictionary* CFMutableDictionaryRef;
 
+class CFDictionaryPropertyBag : public IPropertyBag {
 public:
-    // IUnknown
-    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
-    virtual ULONG STDMETHODCALLTYPE AddRef(void);
-    virtual ULONG STDMETHODCALLTYPE Release(void);
+    static COMPtr<CFDictionaryPropertyBag> createInstance();
 
-    // IPropertyBag
-    virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read( 
-        /* [in] */ LPCOLESTR pszPropName,
-        /* [out][in] */ VARIANT *pVar,
-        /* [in] */ IErrorLog *pErrorLog);
-        
-    virtual HRESULT STDMETHODCALLTYPE Write( 
-        /* [in] */ LPCOLESTR pszPropName,
-        /* [in] */ VARIANT *pVar);
+    // IUnknown
+    virtual ULONG STDMETHODCALLTYPE AddRef();
+    virtual ULONG STDMETHODCALLTYPE Release();
 
     void setDictionary(CFMutableDictionaryRef dictionary);
     CFMutableDictionaryRef dictionary() const;
 
 private:
+    CFDictionaryPropertyBag();
+    ~CFDictionaryPropertyBag();
+
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);
+
+    // IPropertyBag
+    virtual HRESULT STDMETHODCALLTYPE Read(LPCOLESTR pszPropName, VARIANT*, IErrorLog*);
+    virtual HRESULT STDMETHODCALLTYPE Write(LPCOLESTR pszPropName, VARIANT*);
+
     RetainPtr<CFMutableDictionaryRef> m_dictionary;
     ULONG m_refCount;
 };
 
-#endif
\ No newline at end of file
+#endif // CFDictionaryPropertyBag_h
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 4fc80ed..946369d 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,75 @@
+2009-11-05  Adam Roben  <aroben at apple.com>
+
+        Make CFDictionaryPropertyBag::createInstance return a COMPtr
+
+        I also cleaned up CFDictionaryPropertyBag's class declaration a little
+        while I was at it.
+
+        Part of <http://webkit.org/b/25294> <rdar://problem/6803127> All
+        WebKit/win classes should return COMPtrs from their static constructor
+        members
+
+        Reviewed by Steve Falkenburg.
+
+        * CFDictionaryPropertyBag.cpp:
+        (CFDictionaryPropertyBag::CFDictionaryPropertyBag): Changed to
+        initialize m_refCount to 0. m_refCount gets increased to 1 by
+        createInstance.
+        (CFDictionaryPropertyBag::createInstance): Changed to return a COMPtr.
+
+        * CFDictionaryPropertyBag.h:
+          - Updated copyright years
+          - Fixed header guard to match current style
+          - Replaced #include of CoreFoundation.h with forward-declaration of
+            CFMutableDictionaryRef
+          - Added #include of COMPtr.h
+          - Fixed opening brace placement in class declaration
+          - Made createInstance return a COMPtr
+          - Made constructor/destructor private
+          - Made QueryInterface and IPropertyBag functions private
+          - Removed unnecessary parameter names and MIDL comments
+
+        * WebCache.cpp:
+        (WebCache::statistics): Updated for change to
+        CFDictionaryPropertyBag::createInstance. Now uses releaseRef to place
+        the IPropertyBag pointers into the s array.
+
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::dispatchDidFailToStartPlugin):
+        * WebDatabaseManager.cpp:
+        (WebDatabaseManager::dispatchDidModifyDatabase):
+        * WebFrame.cpp:
+        (WebFrame::createJavaAppletWidget):
+        Updated for change to CFDictionaryPropertyBag::createInstance.
+
+        * WebHistory.cpp: Removed releaseUserInfo, which is no longer needed.
+        That function was also doing an unnecessary call to setDictionary(0).
+        (createUserInfoFromArray):
+        (createUserInfoFromHistoryItem):
+        Changed to return COMPtr.
+
+        (WebHistory::loadFromURL): Updated for change to
+        CFDictionaryPropertyBag::createInstance.
+
+        (WebHistory::removeAllItems): Updated for change to
+        CFDictionaryPropertyBag::createInstance, which fixed a leak! We had
+        forgotten to call releaseUserInfo here.
+
+        (WebHistory::removeItem):
+        (WebHistory::addItem):
+        (WebHistory::visitedURL):
+        * WebIconDatabase.cpp:
+        (postDidAddIconNotification):
+        Updated for change to CFDictionaryPropertyBag::createInstance.
+
+        * WebKitClassFactory.cpp:
+        (releaseRefFromCreateInstance): Added this overloaded function
+        template to abstract away the difference between createInstance
+        functions that return a ref'd pointer and createInstance functions
+        that return a COMPtr.
+        (WebKitClassFactory::CreateInstance): Changed to use
+        releaseRefFromCreateInstance.
+
 2009-11-03  Brian Weinstein  <bweinstein at apple.com>
 
         Reviewed by Steve Falkenburg.
diff --git a/WebKit/win/WebCache.cpp b/WebKit/win/WebCache.cpp
index c7351b0..d82fc43 100644
--- a/WebKit/win/WebCache.cpp
+++ b/WebKit/win/WebCache.cpp
@@ -129,9 +129,9 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics(
     value.adoptCF(CFNumberCreate(0, kCFNumberIntType, &stat.scripts.count));
     CFDictionaryAddValue(dictionary.get(), scriptsKey, value.get());
 
-    CFDictionaryPropertyBag* propBag = CFDictionaryPropertyBag::createInstance();
+    COMPtr<CFDictionaryPropertyBag> propBag = CFDictionaryPropertyBag::createInstance();
     propBag->setDictionary(dictionary.get());
-    s[0] = propBag;
+    s[0] = propBag.releaseRef();
 
     dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
@@ -153,7 +153,7 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics(
 
     propBag = CFDictionaryPropertyBag::createInstance();
     propBag->setDictionary(dictionary.get());
-    s[1] = propBag;
+    s[1] = propBag.releaseRef();
 
     dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
@@ -175,7 +175,7 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics(
 
     propBag = CFDictionaryPropertyBag::createInstance();
     propBag->setDictionary(dictionary.get());
-    s[2] = propBag;
+    s[2] = propBag.releaseRef();
 
     dictionary.adoptCF(CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 
@@ -197,7 +197,7 @@ HRESULT STDMETHODCALLTYPE WebCache::statistics(
 
     propBag = CFDictionaryPropertyBag::createInstance();
     propBag->setDictionary(dictionary.get());
-    s[3] = propBag;
+    s[3] = propBag.releaseRef();
 
     return S_OK;
 }
diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
index 2a3bf3c..0ec3f43 100644
--- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -747,7 +747,7 @@ void WebFrameLoaderClient::dispatchDidFailToStartPlugin(const PluginView* plugin
         }
     }
 
-    COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+    COMPtr<CFDictionaryPropertyBag> userInfoBag = CFDictionaryPropertyBag::createInstance();
     userInfoBag->setDictionary(userInfo.get());
  
     int errorCode = 0;
diff --git a/WebKit/win/WebDatabaseManager.cpp b/WebKit/win/WebDatabaseManager.cpp
index a531997..989f33c 100644
--- a/WebKit/win/WebDatabaseManager.cpp
+++ b/WebKit/win/WebDatabaseManager.cpp
@@ -364,7 +364,7 @@ void WebDatabaseManager::dispatchDidModifyDatabase(SecurityOrigin* origin, const
     RetainPtr<CFStringRef> str(AdoptCF, databaseName.createCFString());
     CFDictionarySetValue(userInfo.get(), databaseNameKey, str.get());
 
-    COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+    COMPtr<CFDictionaryPropertyBag> userInfoBag = CFDictionaryPropertyBag::createInstance();
     userInfoBag->setDictionary(userInfo.get());
 
     notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), userInfoBag.get());
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index 0a1f6d0..1e64d1a 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -1691,7 +1691,7 @@ PassRefPtr<Widget> WebFrame::createJavaAppletWidget(const IntSize& pluginSize, H
     if (FAILED(d->webView->resourceLoadDelegate(&resourceLoadDelegate)))
         return pluginView;
 
-    COMPtr<CFDictionaryPropertyBag> userInfoBag(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+    COMPtr<CFDictionaryPropertyBag> userInfoBag = CFDictionaryPropertyBag::createInstance();
 
     ResourceError resourceError(String(WebKitErrorDomain), WebKitErrorJavaUnavailable, String(), String());
     COMPtr<IWebError> error(AdoptCOM, WebError::createInstance(resourceError, userInfoBag.get()));
diff --git a/WebKit/win/WebHistory.cpp b/WebKit/win/WebHistory.cpp
index deb75e5..5383a0c 100644
--- a/WebKit/win/WebHistory.cpp
+++ b/WebKit/win/WebHistory.cpp
@@ -96,7 +96,7 @@ static bool areEqualOrClose(double d1, double d2)
     return (diff < .000001 && diff > -.000001);
 }
 
-static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
+static COMPtr<CFDictionaryPropertyBag> createUserInfoFromArray(BSTR notificationStr, CFArrayRef arrayItem)
 {
     RetainPtr<CFMutableDictionaryRef> dictionary(AdoptCF, 
         CFDictionaryCreateMutable(0, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
@@ -104,28 +104,19 @@ static CFDictionaryPropertyBag* createUserInfoFromArray(BSTR notificationStr, CF
     RetainPtr<CFStringRef> key(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(notificationStr));
     CFDictionaryAddValue(dictionary.get(), key.get(), arrayItem);
 
-    CFDictionaryPropertyBag* result = CFDictionaryPropertyBag::createInstance();
+    COMPtr<CFDictionaryPropertyBag> result = CFDictionaryPropertyBag::createInstance();
     result->setDictionary(dictionary.get());
     return result;
 }
 
-static CFDictionaryPropertyBag* createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
+static COMPtr<CFDictionaryPropertyBag> createUserInfoFromHistoryItem(BSTR notificationStr, IWebHistoryItem* item)
 {
     // reference counting of item added to the array is managed by the CFArray value callbacks
     RetainPtr<CFArrayRef> itemList(AdoptCF, CFArrayCreate(0, (const void**) &item, 1, &MarshallingHelpers::kIUnknownArrayCallBacks));
-    CFDictionaryPropertyBag* info = createUserInfoFromArray(notificationStr, itemList.get());
+    COMPtr<CFDictionaryPropertyBag> info = createUserInfoFromArray(notificationStr, itemList.get());
     return info;
 }
 
-static void releaseUserInfo(CFDictionaryPropertyBag* userInfo)
-{
-    // free the dictionary
-    userInfo->setDictionary(0);
-    int result = userInfo->Release();
-    (void)result;
-    ASSERT(result == 0);   // make sure no one else holds a reference to the userInfo.
-}
-
 // WebHistory -----------------------------------------------------------------
 
 WebHistory::WebHistory()
@@ -264,9 +255,8 @@ HRESULT STDMETHODCALLTYPE WebHistory::loadFromURL(
         goto exit;
 
     if (CFArrayGetCount(discardedItems.get()) > 0) {
-        CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get());
-        hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo);
-        releaseUserInfo(userInfo);
+        COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryItemsDiscardedWhileLoadingNotification), discardedItems.get());
+        hr = postNotification(kWebHistoryItemsDiscardedWhileLoadingNotification, userInfo.get());
         if (FAILED(hr))
             goto exit;
     }
@@ -465,8 +455,8 @@ HRESULT STDMETHODCALLTYPE WebHistory::removeAllItems( void)
 
     PageGroup::removeAllVisitedLinks();
 
-    CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get());
-    return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo);
+    COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get());
+    return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo.get());
 }
 
 HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays( 
@@ -644,10 +634,9 @@ HRESULT WebHistory::removeItem(IWebHistoryItem* entry)
     if (FAILED(hr))
         return hr;
 
-    CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+    COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem(
         getNotificationString(kWebHistoryItemsRemovedNotification), entry);
-    hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo);
-    releaseUserInfo(userInfo);
+    hr = postNotification(kWebHistoryItemsRemovedNotification, userInfo.get());
 
     return hr;
 }
@@ -695,10 +684,9 @@ HRESULT WebHistory::addItem(IWebHistoryItem* entry, bool discardDuplicate, bool*
 
     CFDictionarySetValue(m_entriesByURL.get(), urlString.get(), entry);
 
-    CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+    COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem(
         getNotificationString(kWebHistoryItemsAddedNotification), entry);
-    hr = postNotification(kWebHistoryItemsAddedNotification, userInfo);
-    releaseUserInfo(userInfo);
+    hr = postNotification(kWebHistoryItemsAddedNotification, userInfo.get());
 
     if (added)
         *added = true;
@@ -754,10 +742,9 @@ void WebHistory::visitedURL(const KURL& url, const String& title, const String&
     COMPtr<WebHistoryItem> item(Query, entry);
     item->historyItem()->setRedirectURLs(0);
 
-    CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem(
+    COMPtr<CFDictionaryPropertyBag> userInfo = createUserInfoFromHistoryItem(
         getNotificationString(kWebHistoryItemsAddedNotification), entry);
-    postNotification(kWebHistoryItemsAddedNotification, userInfo);
-    releaseUserInfo(userInfo);
+    postNotification(kWebHistoryItemsAddedNotification, userInfo.get());
 }
 
 HRESULT WebHistory::itemForURLString(
diff --git a/WebKit/win/WebIconDatabase.cpp b/WebKit/win/WebIconDatabase.cpp
index 315db9e..9b87c2b 100644
--- a/WebKit/win/WebIconDatabase.cpp
+++ b/WebKit/win/WebIconDatabase.cpp
@@ -358,7 +358,7 @@ static void postDidAddIconNotification(const String& pageURL, WebIconDatabase* i
     RetainPtr<CFStringRef> url(AdoptCF, pageURL.createCFString());
     CFDictionaryAddValue(dictionary.get(), WebIconDatabase::iconDatabaseNotificationUserInfoURLKey(), url.get());
 
-    COMPtr<CFDictionaryPropertyBag> userInfo(AdoptCOM, CFDictionaryPropertyBag::createInstance());
+    COMPtr<CFDictionaryPropertyBag> userInfo = CFDictionaryPropertyBag::createInstance();
     userInfo->setDictionary(dictionary.get());
 
     IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
diff --git a/WebKit/win/WebKitClassFactory.cpp b/WebKit/win/WebKitClassFactory.cpp
index c2143b5..27b053d 100644
--- a/WebKit/win/WebKitClassFactory.cpp
+++ b/WebKit/win/WebKitClassFactory.cpp
@@ -126,6 +126,19 @@ ULONG STDMETHODCALLTYPE WebKitClassFactory::Release(void)
     return newRef;
 }
 
+// FIXME: Remove these functions once all createInstance() functions return COMPtr.
+template <typename T>
+static T* releaseRefFromCreateInstance(T* object)
+{
+    return object;
+}
+
+template <typename T>
+static T* releaseRefFromCreateInstance(COMPtr<T> object)
+{
+    return object.releaseRef();
+}
+
 // IClassFactory --------------------------------------------------------------
 
 HRESULT STDMETHODCALLTYPE WebKitClassFactory::CreateInstance(IUnknown* pUnkOuter, REFIID riid, void** ppvObject)
@@ -138,7 +151,7 @@ HRESULT STDMETHODCALLTYPE WebKitClassFactory::CreateInstance(IUnknown* pUnkOuter
 
 #define INITIALIZE_IF_CLASS(cls) \
     if (IsEqualGUID(m_targetClass, CLSID_##cls)) \
-        unknown = static_cast<I##cls*>(cls::createInstance()); \
+        unknown = static_cast<I##cls*>(releaseRefFromCreateInstance(cls::createInstance())); \
     else \
     // end of macro
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list