Problem with gtkmm initialization?
- From: "Germán Diago" <germandiago gmail com>
- To: gtkmm-list gnome org
- Subject: Problem with gtkmm initialization?
- Date: Tue, 28 Oct 2008 14:43:14 +0100
Hello. I've got some problems with this (simplified) code:
/********************************NORMAL GTKMM
CODE************************************/
struct Columnas : public Gtk::TreeModelColumnRecord {
Gtk::TreeModelColumn<Glib::ustring> pluginname;
Gtk::TreeModelColumn<Glib::ustring> pluginversion;
Columnas()
{
add(pluginname);
add(pluginversion);
}
};
}
class PluginsView : public Gtk::VBox {
private:
Gtk::TreeView view_;
Glib::RefPtr<Gtk::ListStore> liststore_;
priv::Columnas cols_;
public:
PluginsView() {}: liststore_(Gtk::ListStore::create(cols_))
{
view_.set_model(liststore_);
view_.append_column("Name", cols_.pluginname);
view_.append_column("Version", cols_.pluginversion);
pack_start(view_, false, false);
}
};
/****************************END NORMAL GTKMM
CODE*********************************7
/*****************************MY
CODE*******************************************************/
class PluginsViewer : public Plugin {
private:
...
//When called, it shows the widget in the application window
virtual void onAboutPlugins()
{
app_.activateWidget("PluginsView");
}
//Register widget.
virtual void init() {
app_.registerWidget("PluginsView", create<PluginsView>());
}
};
REGISTER_PLUGIN(PluginsViewer)
This code is compiled as a shared library and loaded later by the
application as a plugin.
create<PluginsView> (which is inside PluginsViewer::init)
is a factory function which returns a boost::shared_ptr<PluginsView>.
The main application inits Gtk
through Gtk::Main m(argc, argv) and then it loads the plugin above.
The problem is that when
PluginsViewer::onAboutPlugins is called, then I get the following
messages (and have no idea why).
Maybe it's shared_ptr's fault? Here are the messages. This one is when
onAboutPlugins is called:
gtkmm-CRITICAL **: const GType* Gtk::TreeModelColumnRecord::types()
const: assertion `!column_types_.empty()' failed
And these are when I close the application:
glibmm-CRITICAL **: Glib::ObjectBase*
Glib::wrap_create_new_wrapper(GObject*): assertion `wrap_func_table !=
0' failed
glibmm-WARNING **: Failed to wrap object of type 'GdkScreenX11'. Hint:
this error is commonly caused by failing to call a library init()
function.
And sometimes it even crashes. Any clue why this happens? Thanks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]