--- gtk/gtkclipboard-quartz.c.orig	2010-08-06 15:51:48.000000000 +1200
+++ gtk/gtkclipboard-quartz.c	2010-08-10 17:12:18.000000000 +1200
@@ -83,9 +83,11 @@
   GtkClipboardGetFunc get_func;
   GtkClipboardClearFunc clear_func;
   gpointer user_data;
-  
 }
 
+  - (void)pasteboard:(NSPasteboard *)sender provideDataForType:(NSString *)type;
+  - (void)pasteboardChangedOwner:(NSPasteboard *)sender;
+
 @end
 
 @implementation GtkClipboardOwner
@@ -94,6 +96,8 @@
   GtkSelectionData selection_data;
   guint info;
 
+  g_message(G_STRLOC "GtkClipboardOwner::provideDataForType"); 
+
   if (!clipboard->target_list)
     return;
 
@@ -119,8 +123,16 @@
 
 - (void)pasteboardChangedOwner:(NSPasteboard *)sender
 {
-  if (clear_func)
+  g_message(G_STRLOC "GtkClipboardOwner::pasteboardChangedOwner()");
+
+  if (clear_func) { 
+    g_message(G_STRLOC "   ... invoking clear_func callback"); 
     clear_func (clipboard, user_data);
+  } 
+  else { 
+    g_message(G_STRLOC "   ... no clear_func registered!");
+  } 
+
 
   [self release];
 }
@@ -129,9 +141,18 @@
 {
   self = [super init];
 
+  g_message(G_STRLOC "GtkClipboardOwner::initWithClipboard()");
+
   if (self) 
     {
       clipboard = aClipboard;
+      if (!clipboard) { 
+	g_message(G_STRLOC "   ... clipboard is NULL!"); 
+      } 
+      else { 
+	clear_func = clipboard->clear_func; 
+        g_message(G_STRLOC "   ... clear func is %p", clear_func);
+      } 
     }
 
   return self;
@@ -333,8 +354,6 @@
 
   pool = [[NSAutoreleasePool alloc] init];
 
-  owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
-
   if (!(clipboard->have_owner && have_owner) ||
       clipboard->user_data != user_data)
     {
@@ -373,6 +392,8 @@
 
   types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
 
+  owner = [[GtkClipboardOwner alloc] initWithClipboard:clipboard];
+
   [clipboard->pasteboard declareTypes:[types allObjects] owner:owner];
   [types release];
   [pool release];
@@ -473,6 +494,7 @@
 void
 gtk_clipboard_clear (GtkClipboard *clipboard)
 {
+  g_message(G_STRLOC "gtk_clipboard_clear() called - revoking quartz pasteboard"); 
   [clipboard->pasteboard declareTypes:nil owner:nil];
 }
 
@@ -922,17 +944,22 @@
       NSString *pasteboard_name;
       clipboard = g_object_new (GTK_TYPE_CLIPBOARD, NULL);
 
-      if (selection == GDK_SELECTION_CLIPBOARD) 
+      if (selection == GDK_SELECTION_CLIPBOARD) {
+          g_message(G_STRLOC "Using NSGeneralPboard");
 	pasteboard_name = NSGeneralPboard;
+      }
       else 
 	{
 	  char *atom_string = gdk_atom_name (selection);
 
+          g_message(G_STRLOC "Using custom pasteboard %s", atom_string); 
+
 	  pasteboard_name = [NSString stringWithFormat:@"_GTK_%@", 
 			     [NSString stringWithUTF8String:atom_string]];
 	  g_free (atom_string);
 	}
 
+      g_message(G_STRLOC " clipboard_peek(): assigning clipboard->pasteboard");
       clipboard->pasteboard = [NSPasteboard pasteboardWithName:pasteboard_name];
 
       [pool release];
