Discussion:
[Foxgui-users] Segfault on FXApp delete
Roland Plüss
2017-01-07 19:11:33 UTC
Permalink
This is along problem I skimmed around by now deleting the FXApp. I
would like to clean up things to get it working properly but it just
ain't working. The following situation:

int main( int argc, char **argv ){
FXApp *app = NULL;
app = new FXApp( "Drag[en]gine Integrated Game Development
Environment", "Drag[en]gine" );
app->init( argc, argv );
FXToolTip *tooltip = new FXToolTip( app );
app->create();
igdeWindowMain *windowMain = new igdeWindowMain( app, &cmdArgs );
windowMain->create();
// main loop... once finished
delete app;
return 0;
}

Doing this I always get a segfault.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7757c9b in FX::FXComposite::~FXComposite() () from
/usr/lib64/libFOX-1.7.so.0
(gdb) bt
#0 0x00007ffff7757c9b in FX::FXComposite::~FXComposite() () from
/usr/lib64/libFOX-1.7.so.0
#1 0x00007ffff782ea09 in FX::FXRootWindow::~FXRootWindow() () from
/usr/lib64/libFOX-1.7.so.0
#2 0x00007ffff773a94e in FX::FXApp::~FXApp() () from
/usr/lib64/libFOX-1.7.so.0
#3 0x00007ffff773aee9 in FX::FXApp::~FXApp() () from
/usr/lib64/libFOX-1.7.so.0
#4 0x000000000040c452 in main (argc=1, argv=<optimized out>) at
src/tools/linux/deigde/src/deigde.cpp:117

Any ideas why FXApp fails like this? Did I not understand something on
FXApp inner workings?
--
Yours sincerely
Plüss Roland

Leader and Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch/wiki )
- As well as various Blender export scripts und game tools
JVZ
2017-01-09 14:00:23 UTC
Permalink
On Sat, 7 Jan 2017 20:11:33 +0100
Post by Roland Plüss
This is along problem I skimmed around by now deleting the FXApp. I
would like to clean up things to get it working properly but it just
int main( int argc, char **argv ){
FXApp *app = NULL;
app = new FXApp( "Drag[en]gine Integrated Game Development
Environment", "Drag[en]gine" );
app->init( argc, argv );
FXToolTip *tooltip = new FXToolTip( app );
app->create();
igdeWindowMain *windowMain = new igdeWindowMain( app, &cmdArgs );
windowMain->create();
// main loop... once finished
delete app;
return 0;
}
Doing this I always get a segfault.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7757c9b in FX::FXComposite::~FXComposite() () from
/usr/lib64/libFOX-1.7.so.0
(gdb) bt
#0 0x00007ffff7757c9b in FX::FXComposite::~FXComposite() () from
/usr/lib64/libFOX-1.7.so.0
#1 0x00007ffff782ea09 in FX::FXRootWindow::~FXRootWindow() () from
/usr/lib64/libFOX-1.7.so.0
#2 0x00007ffff773a94e in FX::FXApp::~FXApp() () from
/usr/lib64/libFOX-1.7.so.0
#3 0x00007ffff773aee9 in FX::FXApp::~FXApp() () from
/usr/lib64/libFOX-1.7.so.0
#4 0x000000000040c452 in main (argc=1, argv=<optimized out>) at
src/tools/linux/deigde/src/deigde.cpp:117
Any ideas why FXApp fails like this? Did I not understand something on
FXApp inner workings?
This ought to work, under normal circumstances; it is the same sequence
as most of my own apps.

I would try run a memory checker like valgrind and see if there is potentially
some heap-corruption going on elsewhere in the code; this could happen, and
(depending on what it touches), manifest itself at a much later time.



-- JVZ



+----------------------------------------------------------------------------+
| Copyright (C) 17:00 01/ 6/2017 Jeroen van der Zijp. All Rights Reserved. |
+----------------------------------------------------------------------------+
Olivier B.
2017-01-09 14:21:31 UTC
Permalink
Does constructing the app on the heap do the same?
Or are you sure are not constructing an other FXApp in your
mainWindows or the code it triggers? FXApp has some static data. You
seem to be able to build multiple ones, but the second deletion
doesn't work well
Post by JVZ
On Sat, 7 Jan 2017 20:11:33 +0100
Post by Roland Plüss
This is along problem I skimmed around by now deleting the FXApp. I
would like to clean up things to get it working properly but it just
int main( int argc, char **argv ){
FXApp *app = NULL;
app = new FXApp( "Drag[en]gine Integrated Game Development
Environment", "Drag[en]gine" );
app->init( argc, argv );
FXToolTip *tooltip = new FXToolTip( app );
app->create();
igdeWindowMain *windowMain = new igdeWindowMain( app, &cmdArgs );
windowMain->create();
// main loop... once finished
delete app;
return 0;
}
Doing this I always get a segfault.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7757c9b in FX::FXComposite::~FXComposite() () from
/usr/lib64/libFOX-1.7.so.0
(gdb) bt
#0 0x00007ffff7757c9b in FX::FXComposite::~FXComposite() () from
/usr/lib64/libFOX-1.7.so.0
#1 0x00007ffff782ea09 in FX::FXRootWindow::~FXRootWindow() () from
/usr/lib64/libFOX-1.7.so.0
#2 0x00007ffff773a94e in FX::FXApp::~FXApp() () from
/usr/lib64/libFOX-1.7.so.0
#3 0x00007ffff773aee9 in FX::FXApp::~FXApp() () from
/usr/lib64/libFOX-1.7.so.0
#4 0x000000000040c452 in main (argc=1, argv=<optimized out>) at
src/tools/linux/deigde/src/deigde.cpp:117
Any ideas why FXApp fails like this? Did I not understand something on
FXApp inner workings?
This ought to work, under normal circumstances; it is the same sequence
as most of my own apps.
I would try run a memory checker like valgrind and see if there is potentially
some heap-corruption going on elsewhere in the code; this could happen, and
(depending on what it touches), manifest itself at a much later time.
-- JVZ
+----------------------------------------------------------------------------+
| Copyright (C) 17:00 01/ 6/2017 Jeroen van der Zijp. All Rights Reserved. |
+----------------------------------------------------------------------------+
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Foxgui-users mailing list
https://lists.sourceforge.net/lists/listinfo/foxgui-users
JVZ
2017-01-09 14:59:13 UTC
Permalink
On Mon, 9 Jan 2017 15:21:31 +0100
Post by Olivier B.
Does constructing the app on the heap do the same?
Or are you sure are not constructing an other FXApp in your
mainWindows or the code it triggers? FXApp has some static data. You
seem to be able to build multiple ones, but the second deletion
doesn't work well
Of course, deleting something twice would be a problem. I really
suggest something like valgrind to root out memory-related problems.

Also, one could build with DEBUG mode (which enables tracing) to
get a more detailed picture of the sequence of things going on.

If anyone knows of additional tools, please offer your suggestions,
as I would love to increase the repertoire of solutions.




-- JVZ






+----------------------------------------------------------------------------+
| Copyright (C) 08:50 01/ 9/2017 Jeroen van der Zijp. All Rights Reserved. |
+----------------------------------------------------------------------------+
Loading...