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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

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

SP_10210577
11-Garnet

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;
}

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Ben_C
6-Contributor
(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
6-Contributor
(To:SP_10210577)

Pass in

ProWstringFree(&f_name);
Ben_C
6-Contributor
(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];

 

Top Tags