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



I found an excellent solution to my own problem.

 

If I use the following declaration in my gtkmm-2.4 code:

 

    Adjustment *hadjustment, *vadjustment;

 

then I can use the same code in gtkmm-2.4 as I do in gtkmm-3.0 to associate these adjustment variables with the adjustments for my ScrolledWindow variable, namely:

 

    hadjustment = scrolled_Window.get_hadjustment();

    vadjustment = scrolled_Window.get_vadjustment();

 

As it turns out, the call to *.get_hadjustment() (or *.get_vadjustment()) in gtkmm-2.4 returns Adjustment* as needed in that case, and the same call in gtkmm-3.0 returns Glib::RefPtr<Gtk::Adjustment> as needed in that case.

 

If the developers of gtkmm-3.0 intended this as part of their design, I congratulate them on their foresight!

 

Jim Tilton

 

From: gtkmm-list-bounces gnome org [mailto:gtkmm-list-bounces gnome org] On Behalf Of Tilton, James C. (GSFC-6063)
Sent: Friday, January 06, 2012 11:14 AM
To: gtkmm-list gnome org
Subject: 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

 

to

 

      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.

 

Thanks.

 

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:      http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and http://science.gsfc.nasa.gov/606.3/TILTON/

 



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