fix(data-collect):解决埋点上传崩溃问题

This commit is contained in:
iaom 2023-11-21 14:01:40 +08:00
parent f0a447c845
commit bd9de3c541
1 changed files with 7 additions and 4 deletions

View File

@ -22,11 +22,14 @@
void DataCollecter::collectLaunchEvent(const QString &plugin, const QString &button) void DataCollecter::collectLaunchEvent(const QString &plugin, const QString &button)
{ {
KCustomProperty property[2]; KCustomProperty *property = new KCustomProperty;
property[0].key = plugin.toLocal8Bit().data(); property->key = strdup(plugin.toLocal8Bit().data());
property[0].value = button.toLocal8Bit().data(); property->value = strdup(button.toLocal8Bit().data());
KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP,KEVENT_CLICK); KTrackData *node = kdk_dia_data_init(KEVENTSOURCE_DESKTOP,KEVENT_CLICK);
kdk_dia_append_custom_property(node,property,1); 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); kdk_dia_data_free(node);
free(property->key);
free(property->value);
delete property;
} }