#5760 HIGH Never A: Objects accumulate on the clipboard, impacting system performance.
Zarro Boogs per Child
bugtracker at laptop.org
Wed Jan 2 17:00:17 EST 2008
#5760: Objects accumulate on the clipboard, impacting system performance.
------------------------+---------------------------------------------------
Reporter: legutierr | Owner: tomeu
Type: defect | Status: new
Priority: high | Milestone: Never Assigned
Component: sugar | Version: Build 650
Resolution: | Keywords: Update.1? review?
Verified: 0 | Blocking:
Blockedby: |
------------------------+---------------------------------------------------
Changes (by tomeu):
* cc: marco (added)
* keywords: => Update.1? review?
Comment:
One possible solution:
{{{
diff --git a/shell/view/frame/clipboardbox.py
b/shell/view/frame/clipboardbox.py
index cf2f9f5..8bb9c1a 100644
--- a/shell/view/frame/clipboardbox.py
+++ b/shell/view/frame/clipboardbox.py
@@ -109,9 +109,26 @@ class ClipboardBox(hippo.CanvasBox):
self._tray.add_item(icon, 0)
icon.show()
self._icons[object_id] = icon
+
+ if self._is_overflowed():
+ logging.debug('ClipboardBox: deleting last object')
+ last_icon = self._tray.get_children()[-1]
+ cb_service = clipboardservice.get_instance()
+ cb_service.delete_object(last_icon.get_object_id())
logging.debug('ClipboardBox: ' + object_id + ' was added.')
+ def _is_overflowed(self):
+ children = self._tray.get_children()
+ if not children:
+ return False
+
+ icon_height = children[-1].get_allocation().height
+ if len(children) * icon_height >
self._tray.get_allocation().height:
+ return True
+ else:
+ return False
+
def _object_deleted_cb(self, cb_service, object_id):
icon = self._icons[object_id]
self._tray.remove_item(icon)
}}}
This limits the number of objects in the clipboard to the maximum that are
visible without having to scroll.
The right solution should include also a limit in the clipboard service
itself, having a limit based on what we consider safe.
--
Ticket URL: <http://dev.laptop.org/ticket/5760#comment:4>
One Laptop Per Child <http://dev.laptop.org>
OLPC bug tracking system
More information about the Bugs
mailing list