Hello,
I am currently using Google's ProtocolBuffers inside my C++ app.
One feature I am adding will generate
X.pb.cc and X.pb.h after I've chosen a proto file from a file dialog.
To do that, I am calling CppGenerator::Generate (I made my own implementation of ZeroCopyOutputStream and GeneratorContext). I also target-linked with pthread (otherwise, the Generate() call will send a SIG ABRT error).
The first time I do that, the .pb.cc and .pb.h files are generated sucessfully. However, when I try to use this feature a second time, I get a SIG ABRT error (it should be a multi-thread problem).
The valgrind output shows :
Process terminating with default action of signal 11 (SIGSEGV)
Access not within mapped region at address 0x38F0000057E
google::protobuf::EnumDescriptor::FindValueByNumber(int) const
google::protobuf::internal::NameofEnum
google::protobuf::compiler::cpp::(anonymous namespace)::SetPrimitiveVariables
google::protobuf::compiler::cpp::PrimitiveFieldGenerator::PrimitiveFieldGenerator
google::protobuf::compiler::cpp::FieldGeneratorMap::MakeGenerator
google::protobuf::compiler::cpp::FieldGeneratorMap::FieldGeneratorMap
google::protobuf::compiler::cpp::MessageGenerator::MessageGenerator
google::protobuf::compiler::cpp::FileGenerator::FileGenerator
google::protobuf::compiler::cpp::CppGenerator::Generate
ProtobufGenerator::GenCode
Is there a way to "reset" the threading system of the program once I have finished the first call of Generate() ?
I have already tried to delete the instance of the CppGenerator and reinstantiate a new one to call Generate() a second time, but it doesn't work.
However, if I call Generate() twice consecutively within one same call of the "GenCode" method, it works.
I can't do that :
ProtobufGenerator::GenCode => google::protobuf::compiler::cpp::CppGenerator::Generate
and then, another time
ProtobufGenerator::GenCode => google::protobuf::compiler::cpp::CppGenerator::Generate
But I can do :
ProtobufGenerator::GenCode =>
google::protobuf::compiler::cpp::CppGenerator::Generate
google::protobuf::compiler::cpp::CppGenerator::Generate
Any idea please?
Thank you very much for your help