Hi,
I've been trying to solve an issue related to the
"annotation_internal->ant.count" declaration in typein.c .
{"ant" is the container for the annotation segments}
static int
annot_in(struct ged *gedp, const char **cmd_argvs, struct rt_db_internal
*intern)
{
int i, p_ver, p_hor;
struct rt_annot_internal *anip;
struct txt_seg *tsg;
intern->idb_type = ID_ANNOT;
intern->idb_meth = &OBJ[ID_ANNOT];
BU_ALLOC(intern->idb_ptr, struct rt_annot_internal);
anip = (struct rt_annot_internal *)intern->idb_ptr;
anip->magic = RT_ANNOT_INTERNAL_MAGIC;
for (i = 0; i<ELEMENTS_PER_POINT; i++)
anip->V[i] = atof(cmd_argvs[3+i]) * gedp->ged_wdbp->dbip->dbi_local2base;
anip->ant.count =1 ;
anip->vert_count = 1;
anip->verts = (point2d_t *)bu_calloc(anip->vert_count,
sizeof(point2d_t), "verts");
BU_ALLOC(tsg, struct txt_seg);
tsg->magic = ANN_TSEG_MAGIC;
tsg->ref_pt = 0;
bu_vls_init(&tsg->label);
bu_vls_strcpy(&tsg->label, cmd_argvs[6]);
for (i = 0; i<ELEMENTS_PER_POINT2D; i++)
anip->verts[0][i] = atof(cmd_argvs[7+i]) *
gedp->ged_wdbp->dbip->dbi_local2base;
p_ver = atoi(cmd_argvs[9]);
p_hor = atoi(cmd_argvs[10]);
rt_pos_flag(&tsg->pt_rel_pos, p_hor, p_ver);
anip->ant.segments = (void **)bu_calloc(1, sizeof(void *), "segs");
anip->ant.segments[0] = (void *)tsg;
return GED_OK;
}
The moment anip->ant.count is initialized to 1( 1 because currently I'm
only testing it for the text, and line_seg, nurb,carc are supposed to be
added on later) the command window crashes due to a segmentation fault,
otherwise everything works fine. I've checked the export5() function again
and again, there seems to be no issue with it.
I've spent hours, but couldn't exactly figure out what is exactly breaking.
Regards,
Shubham Rathore(:gabbar1947)
On Fri, Jun 23, 2017 at 9:05 PM, Shubham Rathore <
shubhamrathore1...@gmail.com> wrote:
> Hi Daniel,
>
> The patch was already ready, as told earlier, all I wanted was to include
> the "typein.c" patch along with the "annot.c" patch.
>
> I accept my fault of having overlooked your mail by mistake. I'll make
> sure this doesn't happen in future and you can expect frequent patch
> submissions from me.
>
> Apologies .
>
> Regards,
> Shubham Rathore(:gabbar1947)
>
> On Fri, Jun 23, 2017 at 8:47 PM, Daniel Roßberg <danielmrossb...@gmail.com
> > wrote:
>
>> Hi Shubham,
>>
>> I had a short look at your code. We talked about it on IRC. But, as
>> announced, I haven't the time for a deeper review now.
>>
>> You should aim for more frequent patch submissions, at least one per
>> week, for the future.
>>
>> Regards,
>> Daniel
>>
>>
>> 2017-06-23 15:31 GMT+02:00 Shubham Rathore <shubhamrathore1...@gmail.com>
>> :
>> > Hi Daniel,
>> >
>> > I have uploaded the patch. It passes the build and the input part seems
>> to
>> > work as of now for the text.
>> >
>> > I'm sorry, I missed your mail regarding the thursday deadline as it got
>> > overriden by another mail on the thread on the same day.
>> >
>> > I have worked hard on understanding the workflow and to write this code
>> and
>> > devoted ample time to the project.
>> >
>> > I'm left with the onscreen rendering part that I aim to complete in the
>> > coming days.
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> BRL-CAD Developer mailing list
>> brlcad-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/brlcad-devel
>>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel