Re: Is gtkmm deleting stuff it shouldn't be deleting ??



Same version of gtkmm, but on linux (mint "maya", gcc 4.7.3) both problematic
proggies work as expected,


On Sat, Nov 2, 2013 at 7:55 AM, John Emmas <johne53 tiscali co uk> wrote:
The following code crashes when built against gtkmm v2.24.4 (using MSVC) :-

        #include "gtkmm/main.h"
        #include "gtkmm/window.h"

        int main (int argc, char *argv[])
        {
          Gtk::Main    app (&argc, &argv);
          Gtk::Window  mainWnd;

                mainWnd.set_title("Hello World!");

                app.run( mainWnd );

                return 0;
        }

The crash occurs at shutdown, when object 'mainWnd' is getting destroyed (I believe "unrealized" is the gtkmm parlance).  OTOH if I modify function main() to look like this, the code doesn't crash any more:-

        int main (int argc, char *argv[])
        {
          Gtk::Main    app (&argc, &argv);
          Gtk::Window*  mainWnd = new Gtk::Window;

                mainWnd->set_title("Hello World!");

                app.run( *mainWnd );

                return 0;
        }

whereas if I add my own 'delete' statement, it crashes in the same way as before, while executing 'delete' :-

        int main (int argc, char *argv[])
        {
          Gtk::Main    app (&argc, &argv);
          Gtk::Window*  mainWnd = new Gtk::Window;

                mainWnd->set_title("Hello World!");

                app.run( *mainWnd );

                delete mainWnd;  // <--- now crashes here !
                return 0;
        }

This suggests to me that gtkmm is deleting objects somewhere (a) without knowing whether or not it created them;  and (b) without even knowing if they were created from the free store.  FWIW if I adapt the code to use pure GTK+ functionality the problem goes away (i.e. if the same program gets implemented using GTK+ instead of gtkmm).  I just wondered if this might ring any bells with anyone here??  Alarm bells, at least..!  ;-)  Thanks.

John
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



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