Index: gst/gstpad.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstpad.c,v
retrieving revision 1.496
diff -u -r1.496 gstpad.c
--- gst/gstpad.c	19 Feb 2006 12:25:01 -0000	1.496
+++ gst/gstpad.c	19 Feb 2006 22:24:13 -0000
@@ -63,6 +63,7 @@
 #include "gst_private.h"
 
 #include "gstpad.h"
+#include "gstghostpad.h"
 #include "gstpadtemplate.h"
 #include "gstenumtypes.h"
 #include "gstmarshal.h"
@@ -876,9 +877,17 @@
 gst_pad_set_blocked_async (GstPad * pad, gboolean blocked,
     GstPadBlockCallback callback, gpointer user_data)
 {
-  gboolean was_blocked;
+  gboolean was_blocked, was_ghost = FALSE;
 
   g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
+  
+  if (GST_IS_GHOST_PAD (pad)) {
+    pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
+    if (!pad) {
+      return FALSE;
+    }
+    was_ghost = TRUE;
+  }
 
   GST_OBJECT_LOCK (pad);
 
@@ -919,6 +928,10 @@
   }
   GST_OBJECT_UNLOCK (pad);
 
+  if (was_ghost) {
+    gst_object_unref (pad);
+  }
+  
   return TRUE;
 
 had_right_state:
@@ -926,6 +939,10 @@
     GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
         "pad %s:%s was in right state", GST_DEBUG_PAD_NAME (pad));
     GST_OBJECT_UNLOCK (pad);
+    
+    if (was_ghost) {
+      gst_object_unref (pad);
+    }
     return FALSE;
   }
 }
Index: gst/gstutils.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/gst/gstutils.c,v
retrieving revision 1.133
diff -u -r1.133 gstutils.c
--- gst/gstutils.c	2 Feb 2006 09:51:18 -0000	1.133
+++ gst/gstutils.c	19 Feb 2006 22:24:15 -0000
@@ -2652,10 +2652,19 @@
 gst_pad_add_data_probe (GstPad * pad, GCallback handler, gpointer data)
 {
   gulong sigid;
+  gboolean was_ghost = FALSE;
 
   g_return_val_if_fail (GST_IS_PAD (pad), 0);
   g_return_val_if_fail (handler != NULL, 0);
 
+  if (GST_IS_GHOST_PAD (pad)) {
+    pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
+    if (!pad) {
+      return 0;
+    }
+    was_ghost = TRUE;
+  }
+  
   GST_OBJECT_LOCK (pad);
   sigid = g_signal_connect (pad, "have-data", handler, data);
   GST_PAD_DO_EVENT_SIGNALS (pad)++;
@@ -2665,6 +2674,10 @@
       GST_PAD_DO_BUFFER_SIGNALS (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
   GST_OBJECT_UNLOCK (pad);
 
+  if (was_ghost) {
+    gst_object_unref (pad);
+  }
+  
   return sigid;
 }
 
@@ -2683,9 +2696,18 @@
 gst_pad_add_event_probe (GstPad * pad, GCallback handler, gpointer data)
 {
   gulong sigid;
+  gboolean was_ghost = FALSE;
 
   g_return_val_if_fail (GST_IS_PAD (pad), 0);
   g_return_val_if_fail (handler != NULL, 0);
+  
+  if (GST_IS_GHOST_PAD (pad)) {
+    pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
+    if (!pad) {
+      return 0;
+    }
+    was_ghost = TRUE;
+  }
 
   GST_OBJECT_LOCK (pad);
   sigid = g_signal_connect (pad, "have-data::event", handler, data);
@@ -2694,6 +2716,10 @@
       GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
   GST_OBJECT_UNLOCK (pad);
 
+  if (was_ghost) {
+    gst_object_unref (pad);
+  }
+  
   return sigid;
 }
 
@@ -2712,10 +2738,19 @@
 gst_pad_add_buffer_probe (GstPad * pad, GCallback handler, gpointer data)
 {
   gulong sigid;
+  gboolean was_ghost = FALSE;
 
   g_return_val_if_fail (GST_IS_PAD (pad), 0);
   g_return_val_if_fail (handler != NULL, 0);
 
+  if (GST_IS_GHOST_PAD (pad)) {
+    pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
+    if (!pad) {
+      return 0;
+    }
+    was_ghost = TRUE;
+  }
+  
   GST_OBJECT_LOCK (pad);
   sigid = g_signal_connect (pad, "have-data::buffer", handler, data);
   GST_PAD_DO_BUFFER_SIGNALS (pad)++;
@@ -2723,6 +2758,10 @@
       GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad));
   GST_OBJECT_UNLOCK (pad);
 
+  if (was_ghost) {
+    gst_object_unref (pad);
+  }
+  
   return sigid;
 }
 
@@ -2736,9 +2775,19 @@
 void
 gst_pad_remove_data_probe (GstPad * pad, guint handler_id)
 {
+  gboolean was_ghost = FALSE;
+  
   g_return_if_fail (GST_IS_PAD (pad));
   g_return_if_fail (handler_id > 0);
-
+  
+  if (GST_IS_GHOST_PAD (pad)) {
+    pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
+    if (!pad) {
+      return;
+    }
+    was_ghost = TRUE;
+  }
+  
   GST_OBJECT_LOCK (pad);
   g_signal_handler_disconnect (pad, handler_id);
   GST_PAD_DO_BUFFER_SIGNALS (pad)--;
@@ -2748,6 +2797,10 @@
       GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad),
       GST_PAD_DO_BUFFER_SIGNALS (pad));
   GST_OBJECT_UNLOCK (pad);
+  
+  if (was_ghost) {
+    gst_object_unref (pad);
+  }
 }
 
 /**
@@ -2760,15 +2813,29 @@
 void
 gst_pad_remove_event_probe (GstPad * pad, guint handler_id)
 {
+  gboolean was_ghost = FALSE;
+  
   g_return_if_fail (GST_IS_PAD (pad));
   g_return_if_fail (handler_id > 0);
-
+  
+  if (GST_IS_GHOST_PAD (pad)) {
+    pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
+    if (!pad) {
+      return;
+    }
+    was_ghost = TRUE;
+  }
+  
   GST_OBJECT_LOCK (pad);
   g_signal_handler_disconnect (pad, handler_id);
   GST_PAD_DO_EVENT_SIGNALS (pad)--;
   GST_DEBUG ("removed event probe from pad %s:%s, now %d event probes",
       GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_EVENT_SIGNALS (pad));
   GST_OBJECT_UNLOCK (pad);
+  
+  if (was_ghost) {
+    gst_object_unref (pad);
+  }
 }
 
 /**
@@ -2781,15 +2848,29 @@
 void
 gst_pad_remove_buffer_probe (GstPad * pad, guint handler_id)
 {
+  gboolean was_ghost = FALSE;
+  
   g_return_if_fail (GST_IS_PAD (pad));
   g_return_if_fail (handler_id > 0);
-
+  
+  if (GST_IS_GHOST_PAD (pad)) {
+    pad = gst_ghost_pad_get_target (GST_GHOST_PAD (pad));
+    if (!pad) {
+      return;
+    }
+    was_ghost = TRUE;
+  }
+  
   GST_OBJECT_LOCK (pad);
   g_signal_handler_disconnect (pad, handler_id);
   GST_PAD_DO_BUFFER_SIGNALS (pad)--;
   GST_DEBUG ("removed buffer probe from pad %s:%s, now %d buffer probes",
       GST_DEBUG_PAD_NAME (pad), GST_PAD_DO_BUFFER_SIGNALS (pad));
   GST_OBJECT_UNLOCK (pad);
+  
+  if (was_ghost) {
+    gst_object_unref (pad);
+  }
 }
 
 /**
