[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-207-g904ce8c)



The branch, master has been updated
       via  904ce8cf81d555debc439ed122322663e74988bf (commit)
       via  a6522190a5102d3b7c7a10726e667ac9d6ea6c3f (commit)
      from  6fcb0765a9bf487003d21214454d474606d807f8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/prototype.h |    1 +
 gschem/src/x_clipboard.c   |   28 +++++++++++++++++++++++++---
 gschem/src/x_window.c      |    2 ++
 3 files changed, 28 insertions(+), 3 deletions(-)


=================
 Commit Messages
=================

commit 904ce8cf81d555debc439ed122322663e74988bf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Jan 27 15:34:58 2009 +0000

    gschem: Rework how clipboards are cleaned up.
    
    Detach selection monitoring callback when deletting a window. The
    callback userdata passes the GSCHEM_TOPLEVEL we're busy freeing,
    causing a crash.
    
    We also need to ensure the clipboard manager (if any) takes our data
    before we free things, so explicitly call gtk_clipboard_store() during
    cleanup if we still own the selection.
    
    Add some code to track when we own the selection, including explicitly
    clearing the clipboard before setting new contents - to avoid a race
    between a clip_clear callback for our old selection, and the new data.

:100644 100644 a1e75b6... a91deba... M	gschem/include/prototype.h
:100644 100644 fc4b55f... 30f6043... M	gschem/src/x_clipboard.c
:100644 100644 0ff901b... 907ab90... M	gschem/src/x_window.c

commit a6522190a5102d3b7c7a10726e667ac9d6ea6c3f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Jan 27 15:34:58 2009 +0000

    gschem: Don't add objects read from the cliboard to the tile system
    
    Prevents corruption / crashes when pasting connectable objects, such
    as nets / pins. The objects are added to the tile system when they
    are placed. (Avoid adding them when reading into the temporary buffer).

:100644 100644 1ea8b08... fc4b55f... M	gschem/src/x_clipboard.c

=========
 Changes
=========

commit 904ce8cf81d555debc439ed122322663e74988bf
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Jan 27 15:34:58 2009 +0000

    gschem: Rework how clipboards are cleaned up.
    
    Detach selection monitoring callback when deletting a window. The
    callback userdata passes the GSCHEM_TOPLEVEL we're busy freeing,
    causing a crash.
    
    We also need to ensure the clipboard manager (if any) takes our data
    before we free things, so explicitly call gtk_clipboard_store() during
    cleanup if we still own the selection.
    
    Add some code to track when we own the selection, including explicitly
    clearing the clipboard before setting new contents - to avoid a race
    between a clip_clear callback for our old selection, and the new data.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index a1e75b6..a91deba 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -743,6 +743,7 @@ void x_scrollbars_update(GSCHEM_TOPLEVEL *w_current);
 void x_basic_warp_cursor(GtkWidget *widget, gint x, gint y);
 /* x_clipboard.c */
 void x_clipboard_init (GSCHEM_TOPLEVEL *w_current);
+void x_clipboard_finish (GSCHEM_TOPLEVEL *w_current);
 gboolean x_clipboard_usable (GSCHEM_TOPLEVEL *w_current);
 gboolean x_clipboard_set (GSCHEM_TOPLEVEL *w_current, const GList *object_list);
 GList *x_clipboard_get (GSCHEM_TOPLEVEL *w_current);
diff --git a/gschem/src/x_clipboard.c b/gschem/src/x_clipboard.c
index fc4b55f..30f6043 100644
--- a/gschem/src/x_clipboard.c
+++ b/gschem/src/x_clipboard.c
@@ -71,7 +71,12 @@ clip_get (GtkClipboard *cb, GtkSelectionData *selection_data,
 static void
 clip_clear (GtkClipboard *cb, gpointer user_data_or_owner)
 {
-  /* Do nothing for now */
+  GSCHEM_TOPLEVEL *w_current = user_data_or_owner;
+  TOPLEVEL *toplevel = w_current->toplevel;
+
+  /* Free the objects in the clipboard buffer */
+  s_delete_object_glist (toplevel, w_current->clipboard_buffer);
+  w_current->clipboard_buffer = NULL;
 }
 
 /* \brief Initialises system clipboard support
@@ -89,6 +94,20 @@ x_clipboard_init (GSCHEM_TOPLEVEL *w_current)
                     w_current);
 }
 
+/* \brief Initialises system clipboard support
+ * \par Function Description
+ * Registers a signal handler to detect if the clipboard has changed
+ * and update the menu item sensitivity if necessary.
+ */
+void
+x_clipboard_finish (GSCHEM_TOPLEVEL *w_current)
+{
+  GtkClipboard *cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+  g_signal_handlers_disconnect_by_func (cb, clip_handle_owner_change, w_current);
+  if (w_current->clipboard_buffer)
+    gtk_clipboard_store (cb);
+}
+
 /* \brief Checks if the system clipboard contains schematic data.
  * \par Function Description
  * Checks whether the current owner of the system clipboard is
@@ -134,8 +153,8 @@ x_clipboard_set (GSCHEM_TOPLEVEL *w_current, const GList *object_list)
   gboolean result;
 
   /* Clear the clipboard buffer */
-  s_delete_object_glist(toplevel, w_current->clipboard_buffer);
-  w_current->clipboard_buffer = NULL;
+  if (w_current->clipboard_buffer)
+    gtk_clipboard_clear (cb);
 
   /* Copy the objects to the clipboard buffer */
   w_current->clipboard_buffer =
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 0ff901b..907ab90 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -556,6 +556,8 @@ void x_window_close(GSCHEM_TOPLEVEL *w_current)
     return;
   }
 
+  x_clipboard_finish (w_current);
+
 #if DEBUG
   o_conn_print_hash(w_current->page_current->conn_table);
 #endif

commit a6522190a5102d3b7c7a10726e667ac9d6ea6c3f
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Tue Jan 27 15:34:58 2009 +0000

    gschem: Don't add objects read from the cliboard to the tile system
    
    Prevents corruption / crashes when pasting connectable objects, such
    as nets / pins. The objects are added to the tile system when they
    are placed. (Avoid adding them when reading into the temporary buffer).

diff --git a/gschem/src/x_clipboard.c b/gschem/src/x_clipboard.c
index 1ea8b08..fc4b55f 100644
--- a/gschem/src/x_clipboard.c
+++ b/gschem/src/x_clipboard.c
@@ -178,8 +178,11 @@ x_clipboard_get (GSCHEM_TOPLEVEL *w_current)
 
   /* Convert the data buffer to OBJECTs */
   buf = gtk_selection_data_get_data (selection_data);
+
+  toplevel->ADDING_SEL = 1; /* HACK: Avoid adding objects to the tile system */
   object_list = o_read_buffer (toplevel, object_list,
                                (gchar *) buf, -1, "Clipboard");
+  toplevel->ADDING_SEL = 0;
 
   gtk_selection_data_free (selection_data);
   return object_list;




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs