Title: [107566] trunk/Source
Revision
107566
Author
[email protected]
Date
2012-02-13 06:18:13 -0800 (Mon, 13 Feb 2012)

Log Message

[GTK] Add GSList to the list of GObject types in GOwnPtr
https://bugs.webkit.org/show_bug.cgi?id=78487

Reviewed by Philippe Normand.

Source/_javascript_Core:

Handle the GSList type in GOwnPtr, by calling g_slist_free in the
implementation of the freeOwnedGPtr template function.

* wtf/gobject/GOwnPtr.cpp:
(WTF::GSList):
(WTF):
* wtf/gobject/GOwnPtr.h:
(WTF):
* wtf/gobject/GTypedefs.h:

Source/WebKit/gtk:

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::runOpenPanel): Use GOwnPtr<GSList> for the
list of filenames returned by gtk_file_chooser_get_filenames().

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (107565 => 107566)


--- trunk/Source/_javascript_Core/ChangeLog	2012-02-13 14:16:32 UTC (rev 107565)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-02-13 14:18:13 UTC (rev 107566)
@@ -1,3 +1,20 @@
+2012-02-13  Mario Sanchez Prada  <[email protected]>
+
+        [GTK] Add GSList to the list of GObject types in GOwnPtr
+        https://bugs.webkit.org/show_bug.cgi?id=78487
+
+        Reviewed by Philippe Normand.
+
+        Handle the GSList type in GOwnPtr, by calling g_slist_free in the
+        implementation of the freeOwnedGPtr template function.
+
+        * wtf/gobject/GOwnPtr.cpp:
+        (WTF::GSList):
+        (WTF):
+        * wtf/gobject/GOwnPtr.h:
+        (WTF):
+        * wtf/gobject/GTypedefs.h:
+
 2012-02-06  Raphael Kubo da Costa  <[email protected]>
 
         [EFL] Drop support for the Curl network backend.

Modified: trunk/Source/_javascript_Core/wtf/gobject/GOwnPtr.cpp (107565 => 107566)


--- trunk/Source/_javascript_Core/wtf/gobject/GOwnPtr.cpp	2012-02-13 14:16:32 UTC (rev 107565)
+++ trunk/Source/_javascript_Core/wtf/gobject/GOwnPtr.cpp	2012-02-13 14:18:13 UTC (rev 107566)
@@ -37,6 +37,11 @@
     g_list_free(ptr);
 }
 
+template <> void freeOwnedGPtr<GSList>(GSList* ptr)
+{
+    g_slist_free(ptr);
+}
+
 template <> void freeOwnedGPtr<GPatternSpec>(GPatternSpec* ptr)
 {
     if (ptr)

Modified: trunk/Source/_javascript_Core/wtf/gobject/GOwnPtr.h (107565 => 107566)


--- trunk/Source/_javascript_Core/wtf/gobject/GOwnPtr.h	2012-02-13 14:16:32 UTC (rev 107565)
+++ trunk/Source/_javascript_Core/wtf/gobject/GOwnPtr.h	2012-02-13 14:18:13 UTC (rev 107566)
@@ -35,6 +35,7 @@
 template <typename T> inline void freeOwnedGPtr(T* ptr);
 template<> void freeOwnedGPtr<GError>(GError*);
 template<> void freeOwnedGPtr<GList>(GList*);
+template<> void freeOwnedGPtr<GSList>(GSList*);
 template<> void freeOwnedGPtr<GPatternSpec>(GPatternSpec*);
 template<> void freeOwnedGPtr<GDir>(GDir*);
 template<> void freeOwnedGPtr<GTimer>(GTimer*);

Modified: trunk/Source/_javascript_Core/wtf/gobject/GTypedefs.h (107565 => 107566)


--- trunk/Source/_javascript_Core/wtf/gobject/GTypedefs.h	2012-02-13 14:16:32 UTC (rev 107565)
+++ trunk/Source/_javascript_Core/wtf/gobject/GTypedefs.h	2012-02-13 14:18:13 UTC (rev 107566)
@@ -53,6 +53,7 @@
 typedef struct _GList GList;
 typedef struct _GPatternSpec GPatternSpec;
 typedef struct _GPollableOutputStream GPollableOutputStream;
+typedef struct _GSList GSList;
 typedef struct _GSocketClient GSocketClient;
 typedef struct _GSocketConnection GSocketConnection;
 typedef struct _GSource GSource;

Modified: trunk/Source/WebKit/gtk/ChangeLog (107565 => 107566)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-02-13 14:16:32 UTC (rev 107565)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-02-13 14:18:13 UTC (rev 107566)
@@ -1,3 +1,14 @@
+2012-02-13  Mario Sanchez Prada  <[email protected]>
+
+        [GTK] Add GSList to the list of GObject types in GOwnPtr
+        https://bugs.webkit.org/show_bug.cgi?id=78487
+
+        Reviewed by Philippe Normand.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::runOpenPanel): Use GOwnPtr<GSList> for the
+        list of filenames returned by gtk_file_chooser_get_filenames().
+
 2012-02-09  Zan Dobersek  <[email protected]>
 
         [GTK] Add DRT support for modal dialogs

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp (107565 => 107566)


--- trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2012-02-13 14:16:32 UTC (rev 107565)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2012-02-13 14:18:13 UTC (rev 107566)
@@ -824,15 +824,14 @@
 
     if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
         if (gtk_file_chooser_get_select_multiple(GTK_FILE_CHOOSER(dialog))) {
-            GSList* filenames = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
+            GOwnPtr<GSList> filenames(gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog)));
             Vector<String> names;
-            for (GSList* item = filenames ; item ; item = item->next) {
+            for (GSList* item = filenames.get() ; item ; item = item->next) {
                 if (!item->data)
                     continue;
                 names.append(filenameToString(static_cast<char*>(item->data)));
                 g_free(item->data);
             }
-            g_slist_free(filenames);
             chooser->chooseFiles(names);
         } else {
             gchar* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to