THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/06/2007 at 18:05, xxxxxxxx wrote:
Cinema 4D Version: R8.2-R10
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;
Maybe it's me, but my plugin is crashing whenever I try to use an array of strings:
strings = bNew String[count];
*strings = String("xxx");
This seems to cause grief. I've double checked the code and it seems on the up-and-up as far as cheching and setting. Is it possibly a problem of initialization of the strings in the array?
This is only a temporary array storing names before tag assignments are made using them. Any alternatives ideas if this doesn't pan out?
On 20/06/2007 at 08:25, xxxxxxxx wrote:
you are defining an array, but the contents of it are undefined. try this.
for(int x=0; x<count; x++)
String *stringRef = strings;
remember to free the strings after.
On 20/06/2007 at 08:43, xxxxxxxx wrote:
Actually I think that the problem has been found. I remembered to free the strings - but too early, forgetting that the individual group references were into that array.
Was trying to use a single array to cover all of the instances in the group tree and handling that got sticky. Instead, the code now does a prepass to count the number of strings needed for each group and allocates individual arrays per group. Each group frees its String array after processing. It now works as expected.