From 8199cf68c6dbb74a7f1b4eedb970427171bb4d9f Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 2 Apr 2016 17:15:43 +0200 Subject: Fix crash on copying orphaned clones Fixed bugs: - https://launchpad.net/bugs/1565272 (bzr r14759) --- src/ui/clipboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index f04d8a591..f0dc33740 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -759,7 +759,7 @@ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) { SPUse *use=dynamic_cast(item); - if(use){ + if (use && use->get_original()) { if(cloned_elements.insert(use->get_original()).second) _copyUsedDefs(use->get_original()); } -- cgit v1.2.3 From d0aef5c0c23b426582534f6a13a90833ac719373 Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Fri, 8 Apr 2016 19:38:40 +0200 Subject: Remove inkscape-specific glib clone function (and get rid of deprecated Glib ScopedPtr use) Fixed bugs: - https://launchpad.net/bugs/1567485 (bzr r14766) --- src/ui/clipboard.cpp | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index f0dc33740..4099bd631 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -146,8 +146,6 @@ private: void _setClipboardColor(guint32); void _userWarn(SPDesktop *, char const *); - void _inkscape_wait_for_targets(std::list &); - // private properites SPDocument *_clipboardSPDoc; ///< Document that stores the clipboard until someone requests it Inkscape::XML::Node *_defs; ///< Reference to the clipboard document's defs node @@ -1302,9 +1300,7 @@ Geom::Scale ClipboardManagerImpl::_getScale(SPDesktop *desktop, Geom::Point cons */ Glib::ustring ClipboardManagerImpl::_getBestTarget() { - // GTKmm's wait_for_targets() is broken, see the comment in _inkscape_wait_for_targets() - std::list targets; // = _clipboard->wait_for_targets(); - _inkscape_wait_for_targets(targets); + std::list targets = _clipboard->wait_for_targets(); // clipboard target debugging snippet /* @@ -1456,39 +1452,6 @@ void ClipboardManagerImpl::_userWarn(SPDesktop *desktop, char const *msg) desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, msg); } - -// GTKMM's clipboard::wait_for_targets is buggy and might return bogus, see -// -// https://bugs.launchpad.net/inkscape/+bug/296778 -// http://mail.gnome.org/archives/gtk-devel-list/2009-June/msg00062.html -// -// for details. Until this has been fixed upstream we will use our own implementation -// of this method, as copied from /gtkmm-2.16.0/gtk/gtkmm/clipboard.cc. -void ClipboardManagerImpl::_inkscape_wait_for_targets(std::list &listTargets) -{ - //Get a newly-allocated array of atoms: - GdkAtom* targets = NULL; - gint n_targets = 0; - gboolean test = gtk_clipboard_wait_for_targets( gtk_clipboard_get(GDK_SELECTION_CLIPBOARD), &targets, &n_targets ); - if (!test || (targets == NULL)) { - return; - } - - //Add the targets to the C++ container: - for (int i = 0; i < n_targets; i++) - { - //Convert the atom to a string: - gchar* const atom_name = gdk_atom_name(targets[i]); - - Glib::ustring target; - if (atom_name) { - target = Glib::ScopedPtr(atom_name).get(); //This frees the gchar*. - } - - listTargets.push_back(target); - } -} - /* ####################################### ClipboardManager class ####################################### */ -- cgit v1.2.3 From 364d0165d1251b22b20e190f7e7c58c5fe72fe88 Mon Sep 17 00:00:00 2001 From: su_v Date: Sat, 9 Apr 2016 04:22:41 +0200 Subject: GTK3 fix Fixed bugs: - https://launchpad.net/bugs/1567485 (bzr r14768) --- src/ui/clipboard.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ui/clipboard.cpp') diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 4099bd631..d581dbf7e 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1300,7 +1300,11 @@ Geom::Scale ClipboardManagerImpl::_getScale(SPDesktop *desktop, Geom::Point cons */ Glib::ustring ClipboardManagerImpl::_getBestTarget() { +#if WITH_GTKMM_3_0 + std::vector targets = _clipboard->wait_for_targets(); +#else std::list targets = _clipboard->wait_for_targets(); +#endif // clipboard target debugging snippet /* -- cgit v1.2.3