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

List:       kde-core-devel
Subject:    Re: And the next victim of lib-unloading is..... QClipBoard
From:       Waldo Bastian <bastian () kde ! org>
Date:       2000-06-28 17:31:34
[Download RAW message or body]

On Tue, 27 Jun 2000, Michael Matz wrote:
> Hi,
>
> On Tue, 27 Jun 2000, Waldo Bastian wrote:
> > Kword puts KWordDrag objects in the clipboard. After unloading KWord
> > these objects don't work any longer.
>
> In what way? I thought the clipboard exists independent of any apps, 

If only. No, each application has its own clipboard. See e.g 
QClipboard::setData(). An application places an object in its own 
clipboard... when someone else "pastes" the clipboard contents it asks the 
application which formats it provides and then requets the data in a format 
that it understands. You will notice this when you select text in e.g. kedit, 
quit the application and then try to paste it. It will not work any longer.

(When 1 application places something in its clipboard, all other apps 
automatically flush there clipboard, creating the idea that there is only 1 
clipboard.)

> so
> how is unloading different of simply quitting kword (I know, that
> qAddPostRoutine stuff, but still...)? 

Typically you don't use the clipboard any more after you quit, but you might 
after you have unloaded a DSO. 

> I mean if it crashes on unloading,
> it should also crash on quitting. 

It doesn't crash on the unloading itself. It crashes when someone tries to 
use the clipboard after unloading. "using the clipboard" includes 
"destructing the clipboard".

> QClipBoard hasn't even data members.

The clipboard can store 1 "QMimeSource" object. (See data()/setData()) If 
that object is not a native Qt object but derived from it and defined in the 
DSO, it's vtables are corrupt after the DSO has unloaded.

The crude solution is to call QClipboard::clear() before we unload a library. 
A nicer solution would be only to do that if the object in the clipboard is 
actually defined in the DSO. But I have no idea how to do that.

Cheers,
Waldo
-- 
Make way, KDE/Linux is coming to a desktop near you!

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

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