Libglademm segmentation fault



Hi,
I'm newbie of this lib programming. I'm using glade-2, gtkmm e
libglademm-2.4 editing with anjuta.
The problem is that i receive always a segmentation fault when I try
to create the windows from my .glade file. This is the source:


PROTOTIPO_DF.cc
#include <config.h>
#include <gtkmm/main.h>
#include <libglademm/xml.h>
#include <iostream>
#include "window1.hh"
#include "dialogLogin.hh"

// This is global and defined as extern in an header file that I
include when I need it (especially in  window1.hh)
Glib::RefPtr<Gnome::Glade::Xml> refXml;

int main(int argc, char **argv)
{
	std::cout << "Head of  main\n";
	try
  {
	  std::cout << "Head of try\n"; // after this i receive SEGMENTATION FAULT
      refXml = Gnome::Glade::Xml::create("prototipo_df.glade",NULL, NULL);
	  std::cout << "Sto all'inizio dentro il try, dopo la crezione\n";
  }
  catch(const Gnome::Glade::XmlError& ex)
  {
    std::cout << ex.what() << std::endl;
    return 1;
  }
Gtk::Main m(&argc, &argv);

window1 *window1 = new class window1();

dialogLogin *dialogLogin = new class dialogLogin();
   m.run(*window1);
delete window1;
delete dialogLogin;
   return 0;
}
-------------------------------------------

PROTOTIPO_DF.hh
#ifndef _PROTOTIPO_DF_HH
	#include <libglademm.h>
	#include <libglademm/xml.h>
	#define _PROTOTIPO_DF_HH
	extern Glib::RefPtr<Gnome::Glade::Xml> refXml;
#endif

-------------------------------------------------
WINDOW1.cc
#include "config.h"
#include "prototipo_df.hh"
#include "window1.hh"
#include "iostream"
#include <gtkmm/dialog.h>
#include <libglademm.h>

void window1::on_menuChange_user1_activate()
{
	Gtk::Dialog * pLogin=0;
	refXml->get_widget("dialogLogin",pLogin);
}

--
Ciao da
N poleone (ICQ# 266220356; MSN Messenger: napoleone1981 yahoo it)
"Le battaglie si vincono con gli uomini che si hanno, non con quelli che
si vorrebbero" (Napoleone Bonaparte)
"Le cose che possiedi prima o poi ti possiedono..." (Fight Club)
"Le donne possono avere bambini...gli uomini computers" (Anonimo)



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