<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>84595</bug_id>
          
          <creation_ts>2004-07-06 20:56:06 +0000</creation_ts>
          <short_desc>selection from lyx freezes klipper</short_desc>
          <delta_ts>2004-11-12 15:09:29 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>10</classification_id>
          <classification>Unmaintained</classification>
          <product>klipper</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Gentoo Packages</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Rutger ter Borg">rutger</reporter>
          <assigned_to name="Carsten Pfeiffer">pfeiffer</assigned_to>
          <cc>gallir</cc>
    
    <cc>jerome</cc>
    
    <cc>l.lunak</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>246318</commentid>
    <comment_count>0</comment_count>
    <who name="Rutger ter Borg">rutger</who>
    <bug_when>2004-07-06 20:56:07 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.2.2)
Installed from:    Gentoo Packages
Compiler:          gcc (GCC) 3.3.3 20040412  Gentoo Linux 3.3.3-r6, ssp-3.3.2-2, pie-8.7.6
OS:                Linux

A selection of text is made in LyX (from www.lyx.org) will always freeze klipper

Steps to reproduce: 

- open lyx
- select some text
- click on the klipper icon
- entire KDE (or only will freeze for a few seconds or longer

Expected behaviour:

- normal popup of klipper, no freeze</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>246319</commentid>
    <comment_count>1</comment_count>
    <who name="Rutger ter Borg">rutger</who>
    <bug_when>2004-07-06 20:57:49 +0000</bug_when>
    <thetext>
some typos: 

A selection of text that is made in Lyx ...
- entire KDE (or only klipper) ...
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>265137</commentid>
    <comment_count>2</comment_count>
    <who name="Ingar Pareliussen">ingar.pareliussen</who>
    <bug_when>2004-09-02 11:01:07 +0000</bug_when>
    <thetext>I have some pieces of information I hope can help to locate the problem...

I have this problem with one of the two PC&apos;s I use. Both use SuSE 9.1. The only two differences I can think of is that the one with the bug uses usb-mouse and have a matrox G400 card. I do not know how this could cause these kind of problems, but I thought I should mention them. 

The problem also manfist itself if you try to change the virtual desktops when something is selected in lyx. This does, however, freeze even kicker. But the rest of the system are responsive... 

Another pice of information is that when I run lyx with -dbg 8, 
I get thousands of X requested selection, and then 
Lost selection. and then a bit later everything returns to normal.

I hope this help :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>284626</commentid>
    <comment_count>3</comment_count>
    <who name="Lubos Lunak">l.lunak</who>
    <bug_when>2004-11-10 18:26:33 +0000</bug_when>
    <thetext>CVS commit by lunakl: 

Protection against too many clipboard data changes. Lyx responds to clipboard data
requests with setting new clipboard data, so if Lyx takes over clipboard,
Klipper notices, requests this data, this triggers &quot;new&quot; clipboard contents
from Lyx, so Klipper notices again, requests this data, ... you get the idea.
Not that this doesn&apos;t really fix Lyx, almost no app is capable of retrieving clipboard
data from it, but the bug is in Lyx after all.
BUG: 84595


  M +24 -1     toplevel.cpp   1.158
  M +5 -1      toplevel.h   1.53


--- kdebase/klipper/toplevel.cpp  #1.157:1.158
@@ -61,9 +61,15 @@
 #define EMPTY (m_popup-&gt;count() - MENU_ITEMS)
 
+// Protection against too many clipboard data changes. Lyx responds to clipboard data
+// requests with setting new clipboard data, so if Lyx takes over clipboard,
+// Klipper notices, requests this data, this triggers &quot;new&quot; clipboard contents
+// from Lyx, so Klipper notices again, requests this data, ... you get the idea.
+const int MAX_CLIPBOARD_CHANGES = 10; // max changes per second
+
 extern bool qt_qclipboard_bailout_hack;
 
 // config == kapp-&gt;config for process, otherwise applet
 KlipperWidget::KlipperWidget( QWidget *parent, KConfig* config )
-    : QWidget( parent ), DCOPObject( &quot;klipper&quot; ), m_config( config )
+    : QWidget( parent ), DCOPObject( &quot;klipper&quot; ), mOverflowCounter( 0 ), m_config( config )
 {
     qt_qclipboard_bailout_hack = true;
@@ -73,4 +79,7 @@ KlipperWidget::KlipperWidget( QWidget *p
     m_selectedItem = -1;
 
+    connect( &amp;mOverflowClearTimer, SIGNAL( timeout()), SLOT( slotClearOverflow()));
+    mOverflowClearTimer.start( 1000 );
+
     QSempty = i18n(&quot;&lt;empty clipboard&gt;&quot;);
 
@@ -637,4 +646,6 @@ void KlipperWidget::slotMoveSelectedToTo
 void KlipperWidget::newClipData()
 {
+    if( ++mOverflowCounter &gt; MAX_CLIPBOARD_CHANGES )
+        return;
     bool selectionMode;
     QString clipContents = clipboardContents( &amp;selectionMode );
@@ -645,4 +656,6 @@ void KlipperWidget::newClipData()
 void KlipperWidget::clipboardSignalArrived( bool selectionMode )
 {
+    if( ++mOverflowCounter &gt; MAX_CLIPBOARD_CHANGES )
+        return;
     // Don&apos;t react on Klipper&apos;s own actions. This signal comes either
     // from this process when it sets the clipboard (in which case ignoring
@@ -753,4 +766,14 @@ void KlipperWidget::setClipboard( const 
 }
 
+void KlipperWidget::slotClearOverflow()
+{
+    if( mOverflowCounter &gt; MAX_CLIPBOARD_CHANGES ) {
+        kdDebug() &lt;&lt; &quot;App owning the clipboard/selection is lame&quot; &lt;&lt; endl;
+        // update to the latest data - this unfortunately may trigger the problem again
+        newClipData();
+    }
+    mOverflowCounter = 0;
+}
+
 QStringList KlipperWidget::getClipboardHistoryMenu()
 {

--- kdebase/klipper/toplevel.h  #1.52:1.53
@@ -21,4 +21,5 @@
 #include &lt;qpixmap.h&gt;
 #include &lt;dcopobject.h&gt;
+#include &lt;qtimer.h&gt;
 
 class QClipboard;
@@ -110,4 +111,5 @@ private slots:
     void slotAboutToHideMenu();
 
+    void slotClearOverflow();
 
 private:
@@ -120,4 +122,5 @@ private:
     QString m_lastString;
     QString m_lastClipboard, m_lastSelection;
+    int mOverflowCounter;
     KPopupMenu *m_popup;
     KToggleAction *toggleURLGrabAction;
@@ -139,4 +142,5 @@ private:
     int URLGrabItem;
     KConfig* m_config;
+    QTimer mOverflowClearTimer;
     ClipboardPoll* poll;
     static KAboutData* about_data;


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>285204</commentid>
    <comment_count>4</comment_count>
    <who name="Lubos Lunak">l.lunak</who>
    <bug_when>2004-11-12 15:07:53 +0000</bug_when>
    <thetext>*** Bug 62082 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>285207</commentid>
    <comment_count>5</comment_count>
    <who name="Lubos Lunak">l.lunak</who>
    <bug_when>2004-11-12 15:09:29 +0000</bug_when>
    <thetext>*** Bug 61814 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>