From kde-core-devel Fri Jul 04 09:57:25 2003 From: Ralf Hoelzer Date: Fri, 04 Jul 2003 09:57:25 +0000 To: kde-core-devel Subject: [PATCH] Kicker freeze X-MARC-Message: https://marc.info/?l=kde-core-devel&m=105731290415140 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_F+UB/mwlHqya2IZ" --Boundary-00=_F+UB/mwlHqya2IZ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Kicker freezes for several seconds if you clear the clipboard history. At least on my system with the current qt-copy. Looks like it happens because Klipper tries to access an empty clipboard at several points. I have attached a patch that fixes it for me. But somebody with a better understanding of this should have a look at it. Maybe this is a Qt bug? I also removed 3 lines that are never called: - config->sync(); - kapp->quit(); - break; regards, Ralf Here's a backtrace of one of the points where it freezes: #0 0x4139710e in select () from /lib/i686/libc.so.6 #1 0x40f9695c in __JCR_LIST__ () from /space/build/kde32/qt-copy/lib/libqt-mt.so.3 #2 0x40a50e3d in qt_xclb_wait_for_event(_XDisplay*, unsigned long, int, _XEvent*, int) (dpy=0x8053e60, win=25165851, type=31, event=0xbfffecd0, timeout=5000) at kernel/qclipboard_x11.cpp:472 #3 0x40a538bc in QClipboardWatcher::getDataInFormat(unsigned long) const (this=0x805ace8, fmtatom=336) at kernel/qclipboard_x11.cpp:1374 #4 0x40a52fc5 in QClipboardWatcher::format(int) const (this=0x805ace8, n=0) at kernel/qclipboard_x11.cpp:1242 #5 0x40ac49ee in QTextDrag::decode(QMimeSource const*, QString&, QCString&) (e=0x805ace8, str=@0xbfffeef0, subtype=@0xbfffeea0) at kernel/qdragobject.cpp:855 #6 0x40abedd4 in QClipboard::text(QCString&, QClipboard::Mode) const (this=0x80a4e50, subtype=@0xbfffeea0, mode=Selection) at kernel/qclipboard.cpp:197 #7 0x40abee73 in QClipboard::text(QClipboard::Mode) const (this=0x80a4e50, mode=Selection) at kernel/qclipboard.cpp:230 #8 0x40abeed6 in QClipboard::text() const (this=0x80a4e50) at kernel/qclipboard.cpp:244 #9 0x40029dc2 in KlipperWidget::clipboardSignalArrived(bool) (this=0x80ca020, selectionMode=240) at toplevel.cpp:644 #10 0x4002a95a in KlipperWidget::qt_invoke(int, QUObject*) (this=0x80ca020, _id=58, _o=0xbfffeff0) at toplevel.moc:137 #11 0x4002ab33 in Klipper::qt_invoke(int, QUObject*) (this=0x80ca020, _id=58, _o=0xbfffeff0) at toplevel.moc:215 #12 0x40b18654 in QObject::activate_signal(QConnectionList*, QUObject*) (this=0x80a4e50, clist=0x80989d0, o=0xbfffeff0) at kernel/qobject.cpp:2357 #13 0x40b183a6 in QObject::activate_signal(int) (this=0x80a4e50, signal=2) at kernel/qobject.cpp:2302 #14 0x40e55ada in QClipboard::selectionChanged() (this=0x80a4e50) at .moc/debug-shared-mt/moc_qclipboard.cpp:88 #15 0x40a5245b in QClipboard::event(QEvent*) (this=0x80a4e50, e=0xbffff3a0) at kernel/qclipboard_x11.cpp:969 #16 0x40ab6489 in QApplication::internalNotify(QObject*, QEvent*) (this=0xbffff620, receiver=0x80a4e50, e=0xbffff3a0) at kernel/qapplication.cpp:2578 #17 0x40ab5946 in QApplication::notify(QObject*, QEvent*) (this=0xbffff620, receiver=0x80a4e50, e=0xbffff3a0) at kernel/qapplication.cpp:2302 #18 0x4064e02e in KApplication::notify(QObject*, QEvent*) (this=0xbffff620, receiver=0x80a4e50, event=0xbffff3a0) at kapplication.cpp:460 #19 0x40a4e5bd in QApplication::sendSpontaneousEvent(QObject*, QEvent*) (receiver=0x80a4e50, event=0xbffff3a0) at kernel/qapplication.h:493 #20 0x40a46645 in QApplication::x11ProcessEvent(_XEvent*) (this=0xbffff620, event=0xbffff510) at kernel/qapplication_x11.cpp:3770 #21 0x40a5f5b6 in QEventLoop::processEvents(unsigned) (this=0x8095d28, flags=4) at kernel/qeventloop_x11.cpp:192 #22 0x40acbc6c in QEventLoop::enterLoop() (this=0x8095d28) at kernel/qeventloop.cpp:198 #23 0x40acbb86 in QEventLoop::exec() (this=0x8095d28) at kernel/qeventloop.cpp:145 #24 0x40ab6605 in QApplication::exec() (this=0xbffff620) at kernel/qapplication.cpp:2701 #25 0x40025860 in kdemain (argc=2, argv=0xbffff7d4) at main.cpp:62 #26 0x08048657 in main (argc=2, argv=0xbffff7d4) at klipper.la.cpp:2 #27 0x412e8082 in __libc_start_main () from /lib/i686/libc.so.6 --Boundary-00=_F+UB/mwlHqya2IZ Content-Type: text/x-diff; charset="us-ascii"; name="kicker.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kicker.diff" Index: toplevel.cpp =================================================================== RCS file: /home/kde/kdebase/klipper/toplevel.cpp,v retrieving revision 1.128 diff -u -p -r1.128 toplevel.cpp --- toplevel.cpp 25 Jun 2003 12:31:57 -0000 1.128 +++ toplevel.cpp 4 Jul 2003 09:49:13 -0000 @@ -190,9 +190,6 @@ void KlipperWidget::clickedMenu(int id) config->writeEntry("AutoStart", false); }else // cancel chosen don't quit break; - config->sync(); - kapp->quit(); - break; } // case URLGRAB_ITEM: // handled with an extra slot // break; @@ -560,7 +557,8 @@ QString KlipperWidget::clipboardContents { clip->setSelectionMode( true ); - QString contents = clip->text(); + QString contents = ""; + if(!bClipEmpty) contents = clip->text(); if ( contents == m_lastSelection ) { @@ -641,10 +639,13 @@ void KlipperWidget::clipboardSignalArriv // qDebug("*** clipboardSignalArrived: %i", selectionMode); clip->setSelectionMode( selectionMode ); - QString text = clip->text(); -// qDebug("-> text is: %s", text.latin1()); - checkClipData( text, selectionMode ); + if(!bClipEmpty) + { + QString text = clip->text(); +// qDebug("-> text is: %s", text.latin1()); + checkClipData( text, selectionMode ); + } m_checkTimer->start(1000); } @@ -661,7 +662,6 @@ void KlipperWidget::checkClipData( const } - bool clipEmpty = (clip->data()->format() == 0L); // qDebug("checkClipData(%i): %s, empty: %i (lastClip: %s, lastSel: %s)", selectionMode, text.latin1(), clipEmpty, m_lastClipboard.latin1(), m_lastSelection.latin1() ); // const char *format; @@ -677,7 +677,7 @@ void KlipperWidget::checkClipData( const if ( text != lastClipRef ) { // keep old clipboard after someone set it to null - if ( clipEmpty && bNoNullClipboard ) + if ( bClipEmpty && bNoNullClipboard ) setClipboard( lastClipRef, selectionMode ); else lastClipRef = text; --Boundary-00=_F+UB/mwlHqya2IZ--