Re: Gtk::TextBuffer::set_text() segfaulting
- From: Murray Cumming <murrayc murrayc com>
- To: sharp badgers com
- Cc: gtkmm-list gnome org
- Subject: Re: Gtk::TextBuffer::set_text() segfaulting
- Date: Fri, 22 Feb 2008 22:49:26 +0100
On Fri, 2008-02-22 at 20:37 +0000, Joe wrote:
> Ok, so the TextBuffer is going into a Gtk::TextView so is declared like:
>
> Glib::RefPtr<Gtk::TextBuffer> buffer;
You do need to actually instantiate the TextBuffer. For instance:
buffer = Gtk::TextBuffer::create();
or get the default buffer:
buffer = textview.get_buffer();
In general you should not try to dereference pointers or smartpointers
before checking that they are not null.
> It seems when I run buffer->set_text() and pass either and std::string
> or a constant char array (ie put something like "cheese" into it) it
> causes a segmentation fault.
>
> The TextBuffer is in the TextView when I try to set the text.
>
> Anyone know what could cause this?
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]