Re: [[gtkmm] Problem with TextBuffer::insert_at_cursor]



If nobody fixes this soon then please add it to bugzilla.

miker lotusland demon co uk wrote:
> Hi,
> 
> I get the following the second time 'insert_at_cursor' is called in the
> following code. To reproduce, compile and run. Click the 'Insert Text'
> button and:-
> 
> (textview:32035): Gtk-WARNING **: GtkTextMark being finalized while
> still in the buffer; someone removed a reference they didn't own! Crash
> impending
> 
> Segmentation fault 22:01:11
> 
> This is with CVS as of 20020916.
> 
> #include <gtkmm/main.h>
> #include <gtkmm/window.h>
> #include <gtkmm/box.h>
> #include <gtkmm/textview.h>
> #include <gtkmm/textbuffer.h>
> #include <gtkmm/buttonbox.h>
> #include <gtkmm/button.h>
> 
> class MyTextView : public Gtk::Window {
>     Gtk::VBox vbox;
>     Gtk::TextView textview;
>     Glib::RefPtr<Gtk::TextBuffer> textbuffer;
>     Gtk::HButtonBox buttonbox;
>     Gtk::Button button;
> public:
>     MyTextView();
>     ~MyTextView();
> 
>     void on_clicked();
> };
> 
> MyTextView::MyTextView()
>     :
>     textbuffer(textview.get_buffer()),
>     button("Inset Text")
> {
>     set_default_size(400, 400);
>     add(vbox);
>     vbox.pack_start(textview);
>     vbox.pack_start(buttonbox, Gtk::PACK_SHRINK);
>     buttonbox.add(button);
>     button.signal_clicked().connect(SigC::slot(*this,
> &MyTextView::on_clicked));
>     show_all();
> }
> 
> MyTextView::~MyTextView()
> {
> }
> 
> void MyTextView::on_clicked()
> {
>     textbuffer->insert_at_cursor("Some text\n");
> }
> 
> int main(int argc, char *argv[])
> {
>     Gtk::Main main(&argc, &argv);
>     MyTextView tv;
>     main.run(tv);
> 
>     return 0;
> }
>  
> 
> I've tried trawling the source but, as I've only just started with
> gtkmm, there's many things I still have to get my head around. Is there
> a possibility the 'insert' TextMark is being destroyed somewhere?
> 
> Any help appreciated.
> 
> -- 
> Mike.
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list



Murray Cumming
murrayc usa net
www.murrayc.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]