[gtkmm] unexplained c++ pointer behaviour



I am having a realy strange problem with a cpp class I am creating:

A mere declaration of any kind of pointer member variable causes segmentation fault. I don't even use the pointer.

I have a working program with a typical class like the following:

class OwnThreadedWindow : public Gtk::Window, public Thread
{
   private:
       int m_someint;
       double m_somedouble;
      .....

   protected:
      virtual void run();
      .....
   public:
      .....
};

By just adding the line in "int * m_pi;" the programm compiles nicely but causes a segmentation fault

class OwnThreadedWindow : public Gtk::Window, public Thread
{
   private:
       int m_someint;
       double m_somedouble;
       .....
       int * m_pi;
   protected:
       virtual void run();
     .....
   public:
      .....
};


The program crashes inside Gtk::Main::run() which is located inside the run method:

void OwnThreadedWindow::run ()
{
       gdk_threads_enter ();
       Gtk::Main::run(*this);
       gdk_threads_leave ();
}

I know I am doing something risky here by inheriting from a gtkmm window kai a commonc++ Thread, but if anyone has an explanation to offer, I would realy appriciate it.

Thanks.




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