In my c++ project, I want to use a Gsv::buffer from GTKsourceview library. I declare my buffer like this:
Glib::RefPtr<Gsv::Buffer> buffer;
I create it :
buffer->create();
But when I want to use some inherited fonction from Gtk::buffer:
buffer->set_text("somethings");
The executable exit and return:
Erreur de segmentation (core dumped)
What is the problem?
Thanks for your help
You create a pointer, but you don't actually make it point anywhere. In essence,
buffer
is a null pointer.From the
RefPtr
default constructor refernece:You need to explicitly create the object pointed to, using the
static
Gsv::Buffer::create
function, like e.g.