Question concerning changes in Gtk::Adjustment from gtkmm-2.4 vs. gtkmm-3.0

I recently successfully ported my gtkmm application from gtkmm-2.4 to gtkmm-3.0.


After successfully creating a gtkmm-3.0 compatible version of my application, I decided it would be good idea to modify my gtkmm-2.4 compatible version to match the gtkmm-3.0 version as closely as possible. This would obviously make the parallel maintenance of the two versions easier.


I was pretty successful in doing this, except for one thing. While my modified gtkmm-2.4 version does compile and run successfully, upon exit it throws a Segmentation Fault. I believe this problem has something to do with the differences in the usage of Gtk::Adjustment between gtkmm-2.4 and gtkmm-3.0.


In “upgrading” my gtkmm-2.4 version, I tried to mimic as closely as possible the gtkmm-3.0 usage of Gtk::Adjustment. In doing so I changed my declaration statement for my Gtk::Adjustment variables from:

      Adjustment hadjustment, vadjustment;   // old gtkmm-2.4 declaration




      Glib::RefPtr<Gtk::Adjustment> hadjustment, vadjustment; // gtkmm-3.0 declaration and new gtkmm-2.4 declaration


My gtkmm-3.0 code associates these Adjustments variables with the adjustments for my ScrolledWindow variable (scrolled_Window) in the following manner:


    hadjustment = scrolled_Window.get_hadjustment();

    vadjustment = scrolled_Window.get_vadjustment();


I tried to mimic this in my new gtkmm-2.4 code as follows:


    Glib::RefPtr<Gtk::Adjustment> local_hadjustment((scrolled_Window.get_hadjustment()));

    Glib::RefPtr<Gtk::Adjustment> local_vadjustment((scrolled_Window.get_vadjustment()));

    hadjustment = local_hadjustment;

    vadjustment = local_vadjustment;


As I mentioned above, this code compiles and runs properly under gtkmm-2.4. But I suspect it is not strictly proper usage – and some problem in this code is causing my program to Segmentation Fault upon exiting.


I would appreciate anyone’s insights into this problem.




Jim Tilton

Dr. James C. Tilton                                                Voice:   301-286-9510

NASA Goddard Space Flight Center                   FAX:     301-286-1776

Mail Code 606.3                                                    E-Mail:  James C Tilton nasa gov

(Computational & Information Sciences and Technology Office)

Greenbelt, MD 20771      

URLs: and


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