c++ - Gsv::buffer error -


in c++ project, want use gsv::buffer gtksourceview library. declare buffer this:

glib::refptr<gsv::buffer> buffer; 

i create :

buffer->create(); 

but when want use inherited fonction gtk::buffer:

 buffer->set_text("somethings"); 

the executable exit , return:

erreur de segmentation (core dumped)

what problem?

thanks help

you create pointer, don't make point anywhere. in essence, buffer null pointer.

from the refptr default constructor refernece:

afterwards null , use of -> cause segmentation fault.

you need explicitly create object pointed to, using static gsv::buffer::create function, e.g.

glib::refptr<gsv::buffer> buffer = gsv::buffer::create(); 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -