[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Fwd: gtkmozembedmm memory management
From:       Cesar Gonzalez <cesargtk () montevideo ! com ! uy>
Date:       2007-03-19 14:01:38
Message-ID: 20070319140214.544193B0018 () menubar ! gnome ! org
[Download RAW message or body]

I'd appreciate if someone can help me with this. Max Vasin, are you there?

Thanks
Cesar

>Date: Thu, 15 Mar 2007 13:13:02 -0300
>To: gtkmm-list@gnome.org
>From: Cesar Gonzalez <cesargtk@montevideo.com.uy>
>Subject: gtkmozembedmm memory management
>
>I'm testing the gtkmozembedmm behaviour and it doesn't seem to be 
>gtkmm compliant on the memory management.
>
>The first example I did to verify this problem is equal to the 
>"simple" example that comes with the gtkmozembedmm sources, with the 
>only difference that it's in loop and the Simple class object is 
>declared as a pointer to be able to build it and destroy it for each 
>iteration. I confirmed it dumps unexpectedly, maybe because I'm not 
>using the mozilla webcontrol correctly...???
>The second example is equal to the first but with a button instead 
>of a webcontrol, but as I hoped in this case it doesn't fail.
>I'm attaching both examples and a makefile so you can verify this too.
>
>The reason of doing this tests is because I need to open and close 
>more than once (here is the problem) a window on my application 
>containing a webcontrol, and to be able to free the memory each time 
>it is closed, but the next time I open the window and the class 
>constructor is called, occurs a segmentation fault like in the first example.
>
>Thanks in advance
>Cesar

["Makefile" (application/octet-stream)]
["main2.cpp" (text/plain)]

#include <gtkmm.h>
#include <gtkmozembedmm.h>

const Glib::ustring test_uri = "file:///usr/share/gtk-doc/html/gtk/index.html";

class Simple : public Gtk::Window
{
  Gtk::Button b;
public:
  Simple()
  {
    set_border_width(5);
    set_default_size(600, 400);
    set_title("Simple");
    add(b);
    b.show();
    b.set_label(test_uri);
  }
};

int main (int argc, char** argv)
{
  Gtk::Main kit(argc, argv);
  while (true)
  {
    Simple * simple = new Simple();
    Gtk::Main::run(*simple);
    delete simple;
  }
  return 0;
}

["main1.cpp" (text/plain)]

#include <gtkmm.h>
#include <gtkmozembedmm.h>

const Glib::ustring test_uri = "file:///usr/share/gtk-doc/html/gtk/index.html";

class Simple : public Gtk::Window
{
  Mozilla::WebControl wc;
public:
  Simple()
  {
    set_border_width(5);
    set_default_size(600, 400);
    set_title("Simple");
    add(wc);
    wc.show();
    wc.load_url(test_uri);
  }
};

int main (int argc, char** argv)
{
  Gtk::Main kit(argc, argv);
  while (true)
  {
    Simple * simple = new Simple();
    Gtk::Main::run(*simple);
    delete simple;
  }
  return 0;
}


_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic