[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Qt patch: QClipboard puts garbage atoms in the clipboard
From:       David Faure <david () mandrakesoft ! com>
Date:       2000-09-17 2:20:34
[Download RAW message or body]

When the SelectionRequest stuff in QClipboard::event copies stuff to the clipboard,
it is mistaken about the number of atoms.

It allocates a QByteArray of "number_of_formats+3" atoms, the 3 additionnal ones being
_optionnally_ added to the byte array :
                        if ( d->source()->provides("image/ppm") )
                            atarget[n++] = XA_PIXMAP;
                        if ( d->source()->provides("image/pbm") )
                            atarget[n++] = XA_BITMAP;
                        if ( d->source()->provides("text/plain") )
                            atarget[n++] = XA_STRING; 

So most of the times, the above is NOT done and the byte array terminates with garbage.

Fix below :

--- kernel/qclipboard_x11.cpp   2000/09/06 14:11:25     1.19
+++ kernel/qclipboard_x11.cpp   2000/09/17 02:15:37
@@ -495,7 +495,7 @@ bool QClipboard::event( QEvent *e )
                                      xa_targets, 32,
                                      PropModeReplace,
                                      (uchar *)data.data(),
-                                     data.size()/4 );
+                                     n*sizeof(Atom)/4 );
                    evt.xselection.property = property;
                } else {
                    bool already_done = FALSE; 

To the KDE people: this is what was leading to so many warnings like :
KDE detected X Error: BadAtom (invalid Atom parameter) 5
  Major opcode:  17

-- 
David FAURE, david@mandrakesoft.com, faure@kde.org
http://www.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today
See http://www.kde.org/kde1-and-kde2.html for how to set up KDE 2

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic