SegFault using provided Set-methods to change variable values.

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Full Member
Full Member
Posts: 7
Joined: 24 Jun 2021, 17:13

SegFault using provided Set-methods to change variable values.

Post by MartinMajewski »


I have a severe issue that triggers a segmentation fault. The documentation is sparse on it.

So my issue is:

I have a variable type created and instantiated with UaModeler and compiled to C++ code.
Everything works so far. I can browse the namespace and see the variable.

However, when I try to change the value in code during runtime, it works exactly one time but crashes the second time with a segfault.

So... in my case: The ObjectTyp ObjT_1 has a FolderTyp SubT_1 and inside it the VariableType VarT_1.
Instantiated I have ObjA with FolderB and VariableC.

In my ObjektAType.cpp implementation (the one UaModeler marks as "not generated every time" - but it does anyway) I try to access the variable with the provided Set-Method.

In ObjAType.cpp there are also the Method skeletons that I have implemented and that I can call from the Client without a problem.
From the ObjAType.cpp can now call getFolderB().setVariableC("newValue"); to set a new value - once.

But when I call it a second time, I get a SegFault.

Why?? How to properly access these variables?

User avatar
Support Team
Hero Member
Hero Member
Posts: 2670
Joined: 18 Mar 2011, 15:09

Re: SegFault using provided Set-methods to change variable values.

Post by Support Team »

Hello MartinMajewski,

I can not replicate this issue. Can you please provide the model (NodeSet) and a few lines of code showing how you change the value in the method call?
Best regards
Unified Automation Support Team

Post Reply