Is gtkmm deleting stuff it shouldn't be deleting ??
- From: John Emmas <johne53 tiscali co uk>
- To: gtkmm <gtkmm-list gnome org>
- Subject: Is gtkmm deleting stuff it shouldn't be deleting ??
- Date: Sat, 02 Nov 2013 14:55:43 +0000
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
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]