--- /tmp/glibmm-2.22.1/glib/glibmm/main.cc	2009-08-16 23:48:47.000000000 -0400
+++ main.cc	2009-12-09 11:42:31.000000000 -0500
@@ -17,7 +17,6 @@
  * License along with this library; if not, write to the Free
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
 #include <glibmm/main.h>
 #include <glibmm/exceptionhandler.h>
 #include <glibmm/thread.h>
@@ -140,9 +139,6 @@
   if(self->node)
     SourceConnectionNode::destroy_notify_callback(self->node);
 
-  if(self->wrapper)
-    Glib::Source::destroy_notify_callback(self->wrapper);
-
   delete self;
 }
 
@@ -703,15 +699,19 @@
 
 /**** Glib::Source *********************************************************/
 
+struct GlibSource 
+{
+    GSource gsource;
+    Glib::Source* wrapper;
+};
+
 // static
 const GSourceFuncs Source::vfunc_table_ =
 {
   &Source::prepare_vfunc,
   &Source::check_vfunc,
   &Source::dispatch_vfunc,
-  0, // finalize_vfunc // We can't use finalize_vfunc because there is no way
-                       // to store a pointer to our wrapper anywhere in GSource so
-                       // that it persists until finalize_vfunc would be called from here.
+  &Source::finalize_vfunc,
   0, // closure_callback
   0, // closure_marshal
 };
@@ -778,8 +778,12 @@
 
 Source::Source()
 :
-  gobject_ (g_source_new(const_cast<GSourceFuncs*>(&vfunc_table_), sizeof(GSource)))
+  gobject_ (g_source_new(const_cast<GSourceFuncs*>(&vfunc_table_), sizeof(GlibSource)))
 {
+  /* provide a way to lookup this Source from the finalize vfunc of the GSource
+   */
+  GlibSource* glibsource = (GlibSource*) gobject_;
+  glibsource->wrapper = this;
   g_source_set_callback(
       gobject_, &glibmm_dummy_source_callback,
       new SourceCallbackData(this), // our persistant callback data object
@@ -787,26 +791,19 @@
 }
 
 Source::Source(GSource* cast_item, GSourceFunc callback_func)
-:
-  gobject_ (cast_item)
 {
-  g_source_set_callback(
-      gobject_, callback_func,
-      new SourceCallbackData(this), // our persistant callback data object
-      &SourceCallbackData::destroy_notify_callback);
+	g_assert_not_reached();
 }
 
 Source::~Source()
 {
-  // The dtor should be invoked by destroy_notify_callback() only, which clears
-  // gobject_ before deleting.  However, we might also get to this point if
+  // The dtor should be invoked by only by the finalize method of the GSource, and
+  // that will set gobject_ to 0. However, we might also get to this point if
   // a derived ctor threw an exception, and then we need to unref manually.
+  //
 
   if(gobject_)
   {
-    SourceCallbackData *const data = glibmm_source_get_callback_data(gobject_);
-    data->wrapper = 0;
-
     GSource *const tmp_gobject = gobject_;
     gobject_ = 0;
 
@@ -915,21 +912,13 @@
 }
 
 // static
-void Source::destroy_notify_callback(void* data)
+void Source::finalize_vfunc(GSource* source)
 {
-  if(data)
-  {
-    Source *const self = static_cast<Source*>(data);
-
-    // gobject_ is already invalid at this point.
-    self->gobject_ = 0;
-
-    // No exception checking: if the dtor throws, you're out of luck anyway.
-    delete self;
-  }
+   GlibSource* glibsource = (GlibSource*) source;
+   glibsource->wrapper->gobject_ = 0;
+   delete glibsource->wrapper;
 }
 
-
 /**** Glib::TimeoutSource **************************************************/
 
 // static
