Re: [gtk-osx-devel] Gdk::Pixbuf::create(Gdk::Window, int, int, int, int) on Mac LION



Further to my problem with a call to Gdk::Pixbuf::create(), I compiled the gtk libraries with debugging support and ran my test program under gdb.  Here is the output from stepping into the Gdk library.  Any suggestions on where to go now?  Exactly where do I file a bug with bugzilla?  Sorry about my ignorance! :-)
********************
(gdb) break 134
Breakpoint 1 at 0x1000021b9: file main-2.cc, line 134.
(gdb) run
Starting program: /Users/jim-2/pixbuf_test/bin/Debug/myprog
Reading symbols for shared libraries ++++++++++++++++++++++.................................................................................................................................................... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
In Area::on_draw()...
In Area::on_draw()...
Realized 1

Breakpoint 1, PlotTest::on_test_clicked (this=0x7fff5fbfee98) at main-2.cc:134
warning: Source file is more recent than executable.
134        Glib::RefPtr<Gdk::Pixbuf> pixbuf_ = Gdk::Pixbuf::create(myarea.myarea_win_, 0,0,winw,winh);
(gdb) s
Gdk::Pixbuf::create (src="" src_x=0, src_y=0, width=500, height=300) at pixbuf.cc:381
381      return Glib::RefPtr<Pixbuf>( new Pixbuf(src, src_x, src_y, width, height) );
(gdb) s
Gdk::Pixbuf::Pixbuf (this=0x102543b90, src="" src_x=0, src_y=0, width=500, height=300)
    at pixbuf.cc:68
68        src->gobj(), src_x, src_y, width, height))
(gdb) s
Glib::ObjectBase::ObjectBase (this=0x102543ba0, __vtt_parm=0x100a005a8) at objectbase.cc:49
49      cpp_destruction_in_progress_  (false)
(gdb) s
50    {}
(gdb) s

(myprog:38919): glibmm-CRITICAL **: Glib::Interface::Interface(const Glib::Interface_Class&): assertion `gobject_ != 0' failed

(myprog:38919): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed
*********************

Here is the program
*********************
#include <gtkmm/main.h>

#include <gtkmm/box.h>
#include <gtkmm/window.h>

#include <gtkmm/separator.h>
#include <gtkmm/textview.h>
#include <gtkmm.h>

#include <gtkmm/drawingarea.h>

#include <gtkmm/image.h>
#include <gtkmm/stock.h>
#include <iostream>
#include <cairomm/context.h>
#include <gtkmm/button.h>


class Area : public Gtk::DrawingArea
{
public:
    Area();
    virtual ~Area();
     Glib::RefPtr<Gdk::Window> myarea_win_;
protected:
    virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
    virtual void on_realize();
};

Area::Area()
{

}

Area::~Area()
{
}

bool Area::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{

   printf("In Area::on_draw()...\n");
    return true;
}

void Area::on_realize()
{
  // We need to call the base on_realize()
  Gtk::DrawingArea::on_realize();
   myarea_win_ = get_window();

}

class PlotTest : public Gtk::Window
{
public:
  PlotTest();
  virtual ~PlotTest();

 protected:
    Area myarea;

  //Signal handlers:
    void on_close_clicked();
    void on_test_clicked();

  //Child widgets:
      Gtk::TextView t_view;
      Gtk::Box m_Box_Top;
      Gtk::Button m_Button_Close;
      Gtk::Button m_Button_Test;
};

PlotTest::PlotTest() :
  m_Box_Top(Gtk::ORIENTATION_VERTICAL),
  m_Button_Close("Close"),
  m_Button_Test("Test Pixbuf Code")
{
  // Set title and border of the window
  set_title("Cairo Test");
  set_border_width(0);

  add(m_Box_Top);

// Add myarea to m_Box3. myarea is an Area object (see myarea.h)

  myarea.set_size_request(500, 300);

  m_Box_Top.pack_start(myarea);

  // Put Close button in Box2:
  m_Box_Top.pack_start(m_Button_Close);
  m_Box_Top.pack_start(m_Button_Test);

  m_Button_Close.set_can_default();
  m_Button_Close.grab_default();

  // Connect the clicked signal of the button to
  m_Button_Close.signal_clicked().connect(sigc::mem_fun(*this,
              &PlotTest::on_close_clicked) );

  m_Button_Test.signal_clicked().connect(sigc::mem_fun(*this,
              &PlotTest::on_test_clicked) );

    show_all();
}

PlotTest::~PlotTest()
{
}

void PlotTest::on_close_clicked()
{
  hide(); //to close the application.
}

void PlotTest::on_test_clicked()
{
     int winx, winy, winw, winh;

     printf("Realized %i\n", myarea.get_realized());

     myarea.get_window()->get_geometry(winx, winy, winw, winh);

    Glib::RefPtr<Gdk::Pixbuf> pixbuf_ = Gdk::Pixbuf::create(myarea.myarea_win_, 0,0,winw,winh);
}

int main(int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);

  PlotTest Prog;
  //Shows the window and returns when it is closed.

  Gtk::Main::run(Prog);

  return 0;
}
****************************



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