I'm just learning about gtkmm for c++. I'm having trouble getting a simple TextBuffer to add a new line of text. I have a class called OutputBox which is an HBox with a TextViewer (called messages) and a TextBuffer (called textBuffer) in it.
Here is a small chunck of the OutputBox class:
OutputBox::OutputBox() {
textBuffer = messages.get_buffer();
};
void OutputBox::addText( string newText) {
textBuffer->insert(textBuffer->begin(), newText);
};
Now I expect that when I pass a string into addText, the new string will be added to the buffer, but instead I get a seg fault.
After running it through gdb, I see that the error comes from the gtkmm libraries here:
template <class T_CppObject> inline
T_CppObject* RefPtr<T_CppObject>::operator->() const
{
return pCppObject_;
}
I'm not really sure what this is telling me either. I assume that I'm incorrectly using the class.