cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

I wonder how to turn off the parameters of the ProAsmcompMdlMdlnameGet function.

SP_10210577
12-Amethyst

I wonder how to turn off the parameters of the ProAsmcompMdlMdlnameGet function.

You are using the ProAsmcompMdlMdlnameGet function. The document instructs you to release the variable whose name is printed to ProWstringFree(), but if you actually use it, an error will occur and you will be forced to exit.

Can you tell me what to do?

 

 

ProError status;

ProFeattype protype;
ProMdlfileType f_type;
ProFamilyMdlName f_name;

	status = ProFeatureTypeGet(feat, &protype);

	if (protype == PRO_FEAT_COMPONENT)
	{
	        status = ProAsmcompMdlMdlnameGet(feat, &f_type, f_name);
		if (f_type == PRO_MDLFILE_PART)										
		{
			ProWstringFree(f_name);
		}
		
		
	}

	return PRO_TK_NO_ERROR;
}

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
Ben_C
12-Amethyst
(To:Ben_C)

Infact, I have managed to replicate the crash using both &f_name and f_name which indicates a bug in the toolkit function.

 

None of the sample code files provided by PTC that use function ProAsmcompMdlMdlnameGet ( ( TestAsm.c )( TestMechanism.c )( UtilVisit.c )( UgMfgMillSeqCreate.c )) call ProWstringFree, so they may be aware of this issue.

 

If you are able to contact PTC support, you should raise this bug. But, frustrating as this is, it appears the solution here may be not to free the data.

 

 

View solution in original post

3 REPLIES 3
Ben_C
12-Amethyst
(To:SP_10210577)

Pass in

ProWstringFree(&f_name);
Ben_C
12-Amethyst
(To:Ben_C)

Infact, I have managed to replicate the crash using both &f_name and f_name which indicates a bug in the toolkit function.

 

None of the sample code files provided by PTC that use function ProAsmcompMdlMdlnameGet ( ( TestAsm.c )( TestMechanism.c )( UtilVisit.c )( UgMfgMillSeqCreate.c )) call ProWstringFree, so they may be aware of this issue.

 

If you are able to contact PTC support, you should raise this bug. But, frustrating as this is, it appears the solution here may be not to free the data.

 

 

This is an error in documentation I believe.

Because, ProFamilyMdlName is an array of fixed size. In this case not needed to free a memory.

typedef wchar_t	ProFamilyMdlName[PRO_FAMILY_MDLNAME_SIZE];

 

Announcements


Top Tags