[gtkmm] gtkmm 2.4 or gtk 2.4 bug



On vmware (windows XP professional)

A bug! I have attached an example that clearly demonstrates the problem.
Compile as g++ drawingarea.cc -o test `pkg-config gtkmm-2.4 --cflags
--libs`

This is just the drawingarea example with 

 std::cout << "getting color" << std::endl;
 Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap ();
 blue_ = Gdk::Color("blue")
 red_ = Gdk::Color("red");
 colormap->alloc_color(blue_);
 colormap->alloc_color(red_);

added to the expose event (was cloned from realize event).

Lay another window on top and just toggle between to cause expose event.
On the 23rd time it dies with 

Gdk-WARNING **: gdkcolor-win32.c:111: DeleteObject failed: Not enough
storage is available to process this command.

Very repeatable on 23rd event ....

Don't have 2.4 on linux yet, so can't try it there.

Guess I should file a bug report .....

Diana M. Esch-Mosher



On Wed, 2004-09-29 at 12:46, Diana Esch-Mosher wrote:
> Well, I reinstalled my mingw to just be 3.2 and recompiled. I still get
> the same crash and dump. I only see references to 3.2.3 though. Attached
> is the Dr. Mingw dump too.
> 
> Diana
> 
> On Wed, 2004-09-29 at 01:47, Cedric Gustin wrote:
> > Diana Esch-Mosher wrote:
> > > I've upgraded my mingw to the "current" configuration as listed at
> > > www.mingw.org/downloads.shtml
> > > 
> > > I used the latest glade installer to pick up gtk 2.4 and picked up the
> > > latest intaller for gtkmm 2.4.
> > 
> > > I see 3.2 references and "bad mangled name". Do I have to install gtk
> > > and gtkmm from source? Should I just go back to 3.2, recompile and use
> > > the gtk/gtkmm bins? I was under the impression I had to upgrade to 3.3
> > > for gtk 2.4. Or is this something else?
> > 
> > Apparently, you stumbled across incompatibilities between g++ 3.2 and 
> > 3.3 on win32. I don't think GTK+ 2.4 requires gcc-3.3 so you can safely 
> > stay with gcc/g++ 3.2 on win32.
> > 
> > I plan to move to gcc-3.3 for the next release of my gtkmm installer.
> > 
> > Cedric
-- 
Diana Esch-Mosher <desch-mosher lanl gov>
Los Alamos National Laboratory
#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gtkmm/drawingarea.h>
#include <gdkmm/colormap.h>
#include <gdkmm/window.h>
#include <iostream> 

class MyArea : public Gtk::DrawingArea
  {
      Glib::RefPtr<Gdk::GC>       gc_;
      Gdk::Color    blue_,red_;
      Glib::RefPtr<Gdk::Window>   window_;
    public:
      MyArea()
        {
          // in the ctor you can only allocate colors, 
          // get_window() returns 0 because we have not be realized
          Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap ();

          blue_ = Gdk::Color("blue");
          red_ = Gdk::Color("red");

          colormap->alloc_color(blue_);
          colormap->alloc_color(red_);
        }
    protected:

      virtual void on_realize()
        {
          // we need to do the default realize
          Gtk::DrawingArea::on_realize();

          // Now we can allocate any additional resources we need
          window_ = get_window();
          Glib::RefPtr<Gdk::Drawable> drawable = window_; //TODO: I get compiler errors without doing this first..
          gc_ = Gdk::GC::create(drawable);
          window_->set_background(red_);
          window_->clear();
          gc_->set_foreground(blue_);
        }


      virtual bool on_expose_event(GdkEventExpose* e)
        {
          // here is where we draw on the window
          window_->clear();
          window_->draw_line(gc_, 1, 1, 100, 100);
	std::cout << "getting color" << std::endl;
          Glib::RefPtr<Gdk::Colormap> colormap = get_default_colormap ();

          blue_ = Gdk::Color("blue");
          red_ = Gdk::Color("red");

          colormap->alloc_color(blue_);
          colormap->alloc_color(red_);
          return true;
        }
  };


int main(int argc, char** argv)
  {
     Gtk::Main kit(argc,argv);
     Gtk::Window win;
     
     MyArea area;
     win.add(area);
     win.show_all();
     
     Gtk::Main::run(win);

     return 0;
  }



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