Re: Equivalent of the gtk g_object_ref/unref functions in gtkmm?
- From: Jef Driesen <jefdriesen hotmail com>
- To: Paul Davis <pjdavis engineering uiowa edu>
- Cc: Murray Cumming <murrayc murrayc com>, gtkmm-list gnome org
- Subject: Re: Equivalent of the gtk g_object_ref/unref functions in gtkmm?
- Date: Tue, 27 Mar 2007 14:25:20 +0200
Paul Davis wrote:
[snip]
First off, can you list the version numbers for:
gtk, gtkmm, glade, and libglademm
You should be able to check them with:
$ pkg-config --modversion gtk+-2.0
$ pkg-config --modversion gtkmm-2.4
$ pkg-config --modversion libglade-2.0
$ pkg-config --modversion libgaldemm-2.4
Jeff, if you have a chance, could you post the least amount of
compilable code that generates this error, along with the glade file.
That'll help making a simple test case to try and isolate the problem.
I did some looking around on bugzilla, but I didn't see anything
related at first glance. I was pretty sure I read an email not too
long ago about a problem similar to this, then again, I could be
crazy.
Found the email in Marc finally:
http://marc.info/?l=gtkmm&m=117287386625401&w=2
I also found another message on the same issue
http://mail.gnome.org/archives/gtkmm-list/2007-March/msg00031.html
This case looks to be related to the issue at hand.
Can anyone find this in bugzilla, or should one be opened. Or does it
even exist in the latest versions?
If you take the bug example from that email, add a delete window
before the call to exit, it appears to be the same bug.
I tried the examples (after added the "delete window", see attachments):
$gcc `pkg-config --cflags --libs gtkmm-2.4 libglademm-2.4` works.cc
$gcc `pkg-config --cflags --libs gtkmm-2.4 libglademm-2.4` buggy.cc
The first one (works.cc) runs fine, but the other one (buggy.cc) exits
with a segmentation fault. I don't need to click the File menu for that.
Closing the program is enough to trigger the segmentation fault (just
like in my own code).
My versions:
gtk 2.8.20
gtkmm 2.8.8
libglade 2.5.1
libglademm 2.6.2
I have:
gtk 2.10.6
gtkmm 2.10.2
libglade 2.6.0
libglademm 2.6.3
#include <gtkmm/statusbar.h>
#include <gtkmm/window.h>
#include <gtkmm/frame.h>
#include <gtkmm/main.h>
#include <gtkmm/messagedialog.h>
#include <libglademm/xml.h>
#include <iostream>
#include <sigc++/retype_return.h>
class test : public Gtk::Window {
public:
test(){//Glib::RefPtr<Gnome::Glade::Xml> refXml) {
Glib::RefPtr<Gnome::Glade::Xml> refXml=
Gnome::Glade::Xml::create("input.glade","main_vbox");
Gtk::VBox *main_vbox;
refXml->get_widget("main_vbox",main_vbox);
add(*main_vbox);
set_default_size(300,300);
set_size_request(200,200);
Gtk::Statusbar *status;
refXml->get_widget("StatusBar",status);
status->push("Created plot");
};
virtual ~test() { };
};
int main(int argc, char **argv) {
Gtk::Main main_instance(argc,argv);
Gtk::Window *window = new test();//refXml);//new Gtk::Window();
#if 0
Glib::RefPtr<Gnome::Glade::Xml> refXml=
Gnome::Glade::Xml::create("input.glade","main_vbox");
if(!refXml)
return 0;
Gtk::Window *window = new test(refXml);//new Gtk::Window();
#endif
main_instance.run(*window);
delete window;
return 0;
}
#include <gtkmm/statusbar.h>
#include <gtkmm/window.h>
#include <gtkmm/frame.h>
#include <gtkmm/main.h>
#include <gtkmm/messagedialog.h>
#include <libglademm/xml.h>
#include <iostream>
#include <sigc++/retype_return.h>
class test : public Gtk::Window {
public:
test(Glib::RefPtr<Gnome::Glade::Xml> refXml) {
/*Glib::RefPtr<Gnome::Glade::Xml> refXml=
Gnome::Glade::Xml::create("input.glade","main_vbox");*/
Gtk::VBox *main_vbox;
refXml->get_widget("main_vbox",main_vbox);
add(*main_vbox);
set_default_size(300,300);
set_size_request(200,200);
Gtk::Statusbar *status;
refXml->get_widget("StatusBar",status);
status->push("Created plot");
};
virtual ~test() { };
};
int main(int argc, char **argv) {
Gtk::Main main_instance(argc,argv);
//Gtk::Window *window = new test();//refXml);//new Gtk::Window();
Glib::RefPtr<Gnome::Glade::Xml> refXml=
Gnome::Glade::Xml::create("input.glade","main_vbox");
if(!refXml)
return 0;
Gtk::Window *window = new test(refXml);//new Gtk::Window();
main_instance.run(*window);
delete window;
return 0;
}
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkWindow" id="StripChartTest">
<property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="title" translatable="yes">window1</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkVBox" id="main_vbox">
<property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkMenuBar" id="menubar1">
<property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
<property
name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
<child>
<widget class="GtkMenuItem" id="menuitem1">
<property name="visible">True</property>
<property name="label" translatable="yes">_File</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menuitem1_menu">
<child>
<widget class="GtkImageMenuItem" id="new1">
<property name="visible">True</property>
<property name="label">gtk-new</property>
<property name="use_stock">True</property>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="quit1">
<property name="visible">True</property>
<property name="label">gtk-quit</property>
<property name="use_stock">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="menuitem4_menu">
<child>
<widget class="GtkImageMenuItem" id="about1">
<property name="visible">True</property>
<property name="label">gtk-about</property>
<property name="use_stock">True</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="StripChartHolder">
<property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkStatusbar" id="StatusBar">
<property name="visible">True</property>
<property name="has_resize_grip">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]