Search the Community
Showing results for tags 'null'.
-
The first time alloc_surf_data_ptr is called, it does not allocate memory and the pointers remain null. The problem is ONLY for TRIM_SURF. No problem with other surface types. If I repeat the call with the same parameters then the memory is allocated: // Make TrimSurf ent eTrimSurf; memset (&eTrimSurf, 0, sizeof (ent)); surf_type& sTrimSurf = eTrimSurf.u.sf; sTrimSurf.s.type = TRIM_SURF; eTrimSurf.refs = 0; // Fill in general trim surf stuff and allocate space for trim surf data... trim_type& trim = sTrimSurf.u.trim; trim.psf = pParentSurface; trim.outer_trimmed = false; trim.n_pts = 0; trim.c_ptr = nullptr; alloc_surf_data_ptr (&sTrimSurf); // TODO: alloc_surf_data_ptr does nothing the first time it is called if (trim.c_ptr == nullptr) { alloc_surf_data_ptr (&sTrimSurf); } ASSERT (trim.c_ptr != nullptr); if (trim.c_ptr == nullptr) return nullptr; This seems like an easy workaround and in most cases it works, but there are cases where the memory is corrupted and an invalid object is written to the database and/or there is a memory leak at the end. I think this is a bug in the chooks SDK. I'm using 2024, haven't tried 2025 yet. Has anyone else run into this problem and have a better solution?
Join us!
eMastercam - your online source for all things Mastercam.
Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.