Changeset 74026 in webkit


Ignore:
Timestamp:
Dec 14, 2010 7:55:24 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-14 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Xan Lopez.

[GTK] Fix several issues in r73858
https://bugs.webkit.org/show_bug.cgi?id=51032

  • It uses both glib private data and it allocates its own private structure.
  • It calls parent's dispose method from finalize.
  • webkit_web_plugin_get_mimetypes() uses a wrong annotation for the returned value, it should be transfer none rather than transfer container.
  • Since the mime type list is internal and we return the list and not a copy, it should never be freed by the caller, so webkit_web_plugin_mime_type_list_free() should be removed from the public API.
  • Mime types list is used uninitialized.
  • Mention in the docs that list returned by webkit_web_plugin_database_get_plugins() must be freed with webkit_web_plugin_database_plugins_list_free().
  • webkit/webkitwebplugin.cpp: (webkit_web_plugin_finalize): (webkit_web_plugin_class_init): (webkit_web_plugin_init):
  • webkit/webkitwebplugin.h:
  • webkit/webkitwebplugindatabase.cpp:
Location:
trunk/WebKit/gtk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/gtk/ChangeLog

    r74018 r74026  
     12010-12-14  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] Fix several issues in r73858
     6        https://bugs.webkit.org/show_bug.cgi?id=51032
     7
     8        - It uses both glib private data and it allocates its own private
     9          structure.
     10        - It calls parent's dispose method from finalize.
     11        - webkit_web_plugin_get_mimetypes() uses a wrong annotation for the
     12          returned value, it should be transfer none rather than transfer
     13          container.
     14        - Since the mime type list is internal and we return the list and not a
     15          copy, it should never be freed by the caller, so
     16          webkit_web_plugin_mime_type_list_free() should be removed from the
     17          public API.
     18        - Mime types list is used uninitialized.
     19        - Mention in the docs that list returned by
     20          webkit_web_plugin_database_get_plugins() must be freed with
     21          webkit_web_plugin_database_plugins_list_free().
     22
     23        * webkit/webkitwebplugin.cpp:
     24        (webkit_web_plugin_finalize):
     25        (webkit_web_plugin_class_init):
     26        (webkit_web_plugin_init):
     27        * webkit/webkitwebplugin.h:
     28        * webkit/webkitwebplugindatabase.cpp:
     29
    1302010-12-14  Diego Escalante Urrelo  <descalante@igalia.com>
    231
  • trunk/WebKit/gtk/webkit/webkitwebplugin.cpp

    r73936 r74026  
    4646}
    4747
    48 void webkit_web_plugin_mime_type_list_free(GSList* list)
    49 {
    50     for (GSList* p = list; p; p = p->next)
    51         freeMIMEType((WebKitWebPluginMIMEType*)p->data);
    52     g_slist_free(list);
    53 }
    54 
    5548static void webkit_web_plugin_finalize(GObject* object)
    5649{
    57     WebKitWebPluginPrivate* priv = WEBKIT_WEB_PLUGIN(object)->priv;
    58 
    59     if (priv->mimeTypes)
    60         webkit_web_plugin_mime_type_list_free(priv->mimeTypes);
    61 
    62     delete WEBKIT_WEB_PLUGIN(object)->priv;
    63 
    64     G_OBJECT_CLASS(webkit_web_plugin_parent_class)->dispose(object);
     50    WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object);
     51    WebKitWebPluginPrivate* priv = plugin->priv;
     52
     53    g_slist_foreach(priv->mimeTypes, (GFunc)freeMIMEType, 0);
     54    g_slist_free(priv->mimeTypes);
     55
     56    delete plugin->priv;
     57
     58    G_OBJECT_CLASS(webkit_web_plugin_parent_class)->finalize(object);
    6559}
    6660
     
    108102                                                         FALSE,
    109103                                                         WEBKIT_PARAM_READWRITE));
    110 
    111     g_type_class_add_private(klass, sizeof(WebKitWebPluginPrivate));
    112104}
    113105
    114106static void webkit_web_plugin_init(WebKitWebPlugin *plugin)
    115107{
    116     WebKitWebPluginPrivate* priv = G_TYPE_INSTANCE_GET_PRIVATE(plugin, WEBKIT_TYPE_WEB_PLUGIN, WebKitWebPluginPrivate);
    117     plugin->priv = priv = new WebKitWebPluginPrivate();
     108    plugin->priv = new WebKitWebPluginPrivate();
     109    plugin->priv->mimeTypes = 0;
    118110}
    119111
     
    176168 * at the moment.
    177169 *
    178  * Returns: (transfer container) (element-type WebKitWebPluginMIMEType): a #GSList of #WebKitWebPluginMIMEType
     170 * Returns: (transfer none) (element-type WebKitWebPluginMIMEType): a #GSList of #WebKitWebPluginMIMEType
    179171 *
    180172 * Since: 1.3.8
  • trunk/WebKit/gtk/webkit/webkitwebplugin.h

    r73936 r74026  
    5555} WebKitWebPluginMIMEType;
    5656
    57 WEBKIT_API void
    58 webkit_web_plugin_mime_type_list_free (GSList*);
    59 
    6057struct _WebKitWebPluginClass {
    6158    GObjectClass parentClass;
  • trunk/WebKit/gtk/webkit/webkitwebplugindatabase.cpp

    r73906 r74026  
    7777 *
    7878 * Returns all #WebKitWebPlugin available in @database.
     79 * The returned list must be freed with webkit_web_plugin_database_plugins_list_free()
    7980 *
    8081 * Returns: (transfer full) (element-type WebKitWebPlugin): a #GSList of #WebKitWebPlugin
Note: See TracChangeset for help on using the changeset viewer.