FIX: crash in ubuntu when doing group

jira: NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ib69be6fdc18918c9d9ae0c840b7dfa6bd4977365
This commit is contained in:
xun.zhang 2025-04-01 16:27:38 +08:00 committed by lane.wei
parent baae89db17
commit 55f79b2737
1 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ struct CustomData
{
int filament_id;
unsigned char r, g, b, a;
std::string type;
char type[64];
};
@ -39,7 +39,6 @@ public:
ColorDataObject(const wxColour &color = *wxBLACK, int filament_id = 0, const std::string &type = "PLA")
: wxCustomDataObject(wxDataFormat("application/customize_format"))
{
std::memset(&m_data, 0, sizeof(m_data));
set_custom_data_filament_id(filament_id);
set_custom_data_color(color);
set_custom_data_type(type);
@ -55,7 +54,8 @@ public:
void SetType(const std::string &type) { set_custom_data_type(type); }
void set_custom_data_type(const std::string& type) {
m_data.type = type;
std::strncpy(m_data.type, type.c_str(), sizeof(m_data.type) - 1);
m_data.type[sizeof(m_data.type) - 1] = '\0';
}
void set_custom_data_filament_id(int filament_id) {