Browse files

Fix Segfault in final GC when using FXSplashWindow.

The internal object allocated when calling FXSplashWindow.new was FXSplashWindow instead
of FXRbSplashWindow, so that no FXRbUnregisterRubyObj() was called. Therefore the object
was double free'd.

Stacktrace was:
==11529== Invalid read of size 8
==11529==    at 0x9265BBC: FX::FXObject::getClassName() const (FXObject.cpp:280)
==11529==    by 0x862EE55: FXRbObject::freefunc(FX::FXObject*) (markfuncs.cpp:77)
==11529==    by 0x4EA6254: finalize_list (gc.c:2944)
==11529==    by 0x4EAAFC2: rb_gc_call_finalizer_at_exit (gc.c:3075)
==11529==    by 0x4E9773B: ruby_cleanup (eval.c:101)
==11529==    by 0x4E979C4: ruby_run_node (eval.c:244)
==11529==    by 0x4007FA: main (main.c:38)
==11529==  Address 0x75e24c0 is 0 bytes inside a block of size 248 free'd
==11529==    at 0x4C2A4BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==11529==    by 0x92B98AD: FX::FXSplashWindow::~FXSplashWindow() (FXSplashWindow.cpp:219)
==11529==    by 0x917C990: FX::FXComposite::~FXComposite() (FXComposite.cpp:304)
==11529==    by 0x929A5EF: FX::FXRootWindow::~FXRootWindow() (FXRootWindow.cpp:209)
==11529==    by 0x929A621: FX::FXRootWindow::~FXRootWindow() (FXRootWindow.cpp:211)
==11529==    by 0x9156DB9: FX::FXApp::~FXApp() (FXApp.cpp:4994)
==11529==    by 0x84912F3: FXRbApp::~FXRbApp() (FXRbApp.cpp:118)
==11529==    by 0x8491347: FXRbApp::~FXRbApp() (FXRbApp.cpp:127)
==11529==    by 0x862EF8E: FXRbObject::freefunc(FX::FXObject*) (markfuncs.cpp:92)
==11529==    by 0x4EA6254: finalize_list (gc.c:2944)
==11529==    by 0x4EAAFC2: rb_gc_call_finalizer_at_exit (gc.c:3075)
==11529==    by 0x4E9773B: ruby_cleanup (eval.c:101)
  • Loading branch information...
1 parent af54382 commit baaf1384823f750adf900ffde67094fb5cda71b2 @larskanis committed Jun 16, 2012
Showing with 12 additions and 4 deletions.
  1. +1 −0 ext/fox16/MANIFEST
  2. +1 −0 ext/fox16/include/impl.h
  3. +10 −4 swig-interfaces/FXSplashWindow.i
View
1 ext/fox16/MANIFEST
@@ -148,6 +148,7 @@ include/FXRbShutter.h
include/FXRbShutterVirtuals.h
include/FXRbSlider.h
include/FXRbSpinner.h
+include/FXRbSplashWindow.h
include/FXRbSplitter.h
include/FXRbStatusbar.h
include/FXRbStatusline.h
View
1 ext/fox16/include/impl.h
@@ -166,6 +166,7 @@ FXRbIMPLEMENT(FXRbShutter,FXShutter,NULL,0)
FXRbIMPLEMENT(FXRbShutterItem,FXShutterItem,NULL,0)
FXRbIMPLEMENT(FXRbSlider,FXSlider,NULL,0)
FXRbIMPLEMENT(FXRbSpinner,FXSpinner,NULL,0)
+FXRbIMPLEMENT(FXRbSplashWindow,FXSplashWindow,NULL,0)
FXRbIMPLEMENT(FXRbSplitter,FXSplitter,NULL,0)
FXRbIMPLEMENT(FXRbSpring,FXSpring,NULL,0)
FXRbIMPLEMENT(FXRbStatusBar,FXStatusBar,NULL,0)
View
14 swig-interfaces/FXSplashWindow.i
@@ -52,11 +52,17 @@ public:
long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
public:
- /// Construct splash window
- FXSplashWindow(FXApp* a,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000);
+ %extend {
+ /// Construct splash window
+ FXSplashWindow(FXApp* a,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000){
+ return new FXRbSplashWindow(a,ic,opts,ms);
+ }
- /// Construct splash window
- FXSplashWindow(FXWindow* own,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000);
+ /// Construct splash window
+ FXSplashWindow(FXWindow* own,FXIcon* ic,FXuint opts=SPLASH_SIMPLE,FXuint ms=5000){
+ return new FXRbSplashWindow(own,ic,opts,ms);
+ }
+ }
/// Set the icon for the splash window
void setIcon(FXIcon* ic);

0 comments on commit baaf138

Please sign in to comment.