[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - libreofficekit/qa

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 9 09:12:55 UTC 2021


 libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx |   42 +++++++--------
 1 file changed, 22 insertions(+), 20 deletions(-)

New commits:
commit a204ab6e8b1c1eabf5318b618d7e2ed2837d9126
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 20 20:11:25 2021 +0000
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Fri Jul 9 11:12:23 2021 +0200

    cid#1474277 Resource leak
    
    and...
    
    cid#1474319 Resource leak
    cid#1473965 Resource leak
    cid#1474109 Resource leak
    cid#1474179 Resource leak
    
    Change-Id: I7daba2a0173a7fe7a912c0febf7957667f0fae83
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112822
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 4efc4a43ff481661990b304f9599f811db39f7dc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118618
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
index fef712ceef0a..be7cd4445536 100644
--- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx
@@ -38,8 +38,8 @@ void btn_clicked(GtkWidget* pButton, gpointer)
         GtvHelpers::userPromptDialog(GTK_WINDOW(window), "Insert Comment", aEntries);
 
         boost::property_tree::ptree aTree;
-        aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
-        aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
+        aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), "string");
+        aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), aEntries["Text"]);
 
         std::stringstream aStream;
         boost::property_tree::write_json(aStream, aTree);
@@ -191,8 +191,12 @@ static void iterateUnoParams(GtkWidget* pWidget, gpointer userdata)
         unoParam[i] = gtk_entry_get_text(GTK_ENTRY(pIt->data));
     }
 
-    pTree->put(boost::property_tree::ptree::path_type(g_strconcat(unoParam[1], "/", "type", nullptr), '/'), unoParam[0]);
-    pTree->put(boost::property_tree::ptree::path_type(g_strconcat(unoParam[1], "/", "value", nullptr), '/'), unoParam[2]);
+    gchar* pPath = g_strconcat(unoParam[1], "/", "type", nullptr);
+    pTree->put(boost::property_tree::ptree::path_type(pPath, '/'), unoParam[0]);
+    g_free(pPath);
+    pPath = g_strconcat(unoParam[1], "/", "value", nullptr);
+    pTree->put(boost::property_tree::ptree::path_type(pPath, '/'), unoParam[2]);
+    g_free(pPath);
 }
 
 void recentUnoChanged( GtkWidget* pSelector, gpointer /* pItem */ )
@@ -256,11 +260,9 @@ void unoCommandDebugger(GtkWidget* pButton, gpointer /* pItem */)
     gtk_widget_show_all(pUnoCmdDialog);
 
     gint res = gtk_dialog_run (GTK_DIALOG(pUnoCmdDialog));
-    switch (res)
-    {
-    case GTK_RESPONSE_OK:
+    if (res == GTK_RESPONSE_OK)
     {
-        const gchar* sUnoCmd = g_strconcat(".uno:", gtk_entry_get_text(GTK_ENTRY(pUnoCmdEntry)), nullptr);
+        gchar* sUnoCmd = g_strconcat(".uno:", gtk_entry_get_text(GTK_ENTRY(pUnoCmdEntry)), nullptr);
 
         boost::property_tree::ptree aTree;
         gtk_container_foreach(GTK_CONTAINER(pUnoParamAreaBox), iterateUnoParams, &aTree);
@@ -273,8 +275,8 @@ void unoCommandDebugger(GtkWidget* pButton, gpointer /* pItem */)
 
         lok_doc_view_post_command(LOK_DOC_VIEW(window->lokdocview), sUnoCmd, (aArguments.empty() ? nullptr : aArguments.c_str()), false);
         addToRecentUnoCommands(window, sUnoCmd, aArguments);
-    }
-        break;
+
+        g_free(sUnoCmd);
     }
 
     gtk_widget_destroy(pUnoCmdDialog);
@@ -649,11 +651,11 @@ void editButtonClicked(GtkWidget* pWidget, gpointer userdata)
     gchar *commentId = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
 
     boost::property_tree::ptree aTree;
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "string");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId));
+    aTree.put(boost::property_tree::ptree::path_type("Id/type", '/'), "string");
+    aTree.put(boost::property_tree::ptree::path_type("Id/value", '/'), std::string(commentId));
 
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
+    aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), "string");
+    aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), aEntries["Text"]);
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
@@ -673,11 +675,11 @@ void replyButtonClicked(GtkWidget* pWidget, gpointer userdata)
     gchar *commentId = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
 
     boost::property_tree::ptree aTree;
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "string");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentId));
+    aTree.put(boost::property_tree::ptree::path_type("Id/type", '/'), "string");
+    aTree.put(boost::property_tree::ptree::path_type("Id/value", '/'), std::string(commentId));
 
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "type", nullptr), '/'), "string");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Text", "/", "value", nullptr), '/'), aEntries["Text"]);
+    aTree.put(boost::property_tree::ptree::path_type("Text/type", '/'), "string");
+    aTree.put(boost::property_tree::ptree::path_type("Text/value", '/'), aEntries["Text"]);
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);
@@ -697,8 +699,8 @@ void deleteCommentButtonClicked(GtkWidget* pWidget, gpointer userdata)
     gchar *commentid = static_cast<gchar*>(g_object_get_data(G_OBJECT(userdata), "id"));
 
     boost::property_tree::ptree aTree;
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "type", nullptr), '/'), "string");
-    aTree.put(boost::property_tree::ptree::path_type(g_strconcat("Id", "/", "value", nullptr), '/'), std::string(commentid));
+    aTree.put(boost::property_tree::ptree::path_type("Id/type", '/'), "string");
+    aTree.put(boost::property_tree::ptree::path_type("Id/value", '/'), std::string(commentid));
 
     std::stringstream aStream;
     boost::property_tree::write_json(aStream, aTree);


More information about the Libreoffice-commits mailing list