Skip to content

Adding simple data to a CAS / SceneCAS::get() crashes  #87

@Sanic

Description

@Sanic

As discussed with @bbferka, how can i add a simple test string to the CAS do use it across different Annotators?

rs::SceneCas scas(tcas);
rs::Annotation someAnnotation = rs::create<rs::Annotation>(tcas);
std::string someStr("mytest");
someAnnotation.source.set(someStr);
someAnnotation.source.get(); // <- This call works
scas.set("example", someAnnotation);

// Read back for verification
rs::Annotation testAnno = rs::create<rs::Annotation>(tcas);
scas.get("example", testAnno);
testAnno.source.get(); // <- This call crashes

This is the error message:

Program received signal SIGSEGV, Segmentation fault.
uima::FeatureStructure::isValid (
    this=0x7ffff7b16db4 <uima::FeatureStructure::getStringValue(uima::Feature const&) const+20>, 
    this@entry=0x7fffffffc5f0) at ../cas/featurestructure.cpp:237
237        return iv_tyFS != 0 && ( iv_cas->getHeap()->isValid(iv_tyFS));

As @bbferka pointed out, a quick fix for this seems to be to use getFS() instead of get() in the second code block. But why is get() crashing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions