Title: [137587] trunk/Source/WebCore
Revision
137587
Author
[email protected]
Date
2012-12-13 06:02:12 -0800 (Thu, 13 Dec 2012)

Log Message

[GTK] Don't leak GStaticRecMutex
https://bugs.webkit.org/show_bug.cgi?id=104901

Patch by Alberto Garcia <[email protected]> on 2012-12-13
Reviewed by Martin Robinson.

The mutex in WebKitWebAudioSourceGStreamer is allocated using
g_new(), but that memory is not freed when the object is
destroyed.

This patch replaces that pointer with the structure itself, which
is faster and doesn't need to be explicitly freed.

* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(_WebKitWebAudioSourcePrivate):
(webkit_web_audio_src_init):
(webKitWebAudioSrcFinalize):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (137586 => 137587)


--- trunk/Source/WebCore/ChangeLog	2012-12-13 13:20:01 UTC (rev 137586)
+++ trunk/Source/WebCore/ChangeLog	2012-12-13 14:02:12 UTC (rev 137587)
@@ -1,3 +1,22 @@
+2012-12-13  Alberto Garcia  <[email protected]>
+
+        [GTK] Don't leak GStaticRecMutex
+        https://bugs.webkit.org/show_bug.cgi?id=104901
+
+        Reviewed by Martin Robinson.
+
+        The mutex in WebKitWebAudioSourceGStreamer is allocated using
+        g_new(), but that memory is not freed when the object is
+        destroyed.
+
+        This patch replaces that pointer with the structure itself, which
+        is faster and doesn't need to be explicitly freed.
+
+        * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
+        (_WebKitWebAudioSourcePrivate):
+        (webkit_web_audio_src_init):
+        (webKitWebAudioSrcFinalize):
+
 2012-12-13  Eugene Klyuchnikov  <[email protected]>
 
         Web Inspector: Network: Sorting cookies by size is broken.

Modified: trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp (137586 => 137587)


--- trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp	2012-12-13 13:20:01 UTC (rev 137586)
+++ trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp	2012-12-13 14:02:12 UTC (rev 137587)
@@ -55,7 +55,7 @@
     GRefPtr<GstElement> wavEncoder;
 
     GRefPtr<GstTask> task;
-    GStaticRecMutex* mutex;
+    GStaticRecMutex mutex;
 
     GSList* pads; // List of queue sink pads. One queue for each planar audio channel.
     GstPad* sourcePad; // src pad of the element, interleaved wav data is pushed to it.
@@ -185,11 +185,10 @@
     priv->provider = 0;
     priv->bus = 0;
 
-    priv->mutex = g_new(GStaticRecMutex, 1);
-    g_static_rec_mutex_init(priv->mutex);
+    g_static_rec_mutex_init(&priv->mutex);
 
     priv->task = gst_task_create(reinterpret_cast<GstTaskFunction>(webKitWebAudioSrcLoop), src);
-    gst_task_set_lock(priv->task.get(), priv->mutex);
+    gst_task_set_lock(priv->task.get(), &priv->mutex);
 }
 
 static void webKitWebAudioSrcConstructed(GObject* object)
@@ -254,7 +253,7 @@
     WebKitWebAudioSrc* src = ""
     WebKitWebAudioSourcePrivate* priv = src->priv;
 
-    g_static_rec_mutex_free(priv->mutex);
+    g_static_rec_mutex_free(&priv->mutex);
 
     g_slist_free_full(priv->pads, reinterpret_cast<GDestroyNotify>(gst_object_unref));
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to