From bd9de3c541d16c65f5a7494a7633b0be8229bf68 Mon Sep 17 00:00:00 2001 From: iaom Date: Tue, 21 Nov 2023 14:01:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(data-collect):=E8=A7=A3=E5=86=B3=E5=9F=8B?= =?UTF-8?q?=E7=82=B9=E4=B8=8A=E4=BC=A0=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsearch/data-collecter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libsearch/data-collecter.cpp b/libsearch/data-collecter.cpp index 8c536e4..bcf1ac5 100644 --- a/libsearch/data-collecter.cpp +++ b/libsearch/data-collecter.cpp @@ -22,11 +22,14 @@ void DataCollecter::collectLaunchEvent(const QString &plugin, const QString &button) { - KCustomProperty property[2]; - property[0].key = plugin.toLocal8Bit().data(); - property[0].value = button.toLocal8Bit().data(); + KCustomProperty *property = new KCustomProperty; + property->key = strdup(plugin.toLocal8Bit().data()); + property->value = strdup(button.toLocal8Bit().data()); KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP,KEVENT_CLICK); kdk_dia_append_custom_property(node,property,1); - kdk_dia_upload_default(node, QStringLiteral("launch").toLocal8Bit().data(), plugin.toLocal8Bit().data()); + kdk_dia_upload_default(node, strdup(QStringLiteral("launch").toLocal8Bit().data()), strdup(plugin.toLocal8Bit().data())); kdk_dia_data_free(node); + free(property->key); + free(property->value); + delete property; }