author | sandman <sandman> | 2002-08-28 23:18:58 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-08-28 23:18:58 (UTC) |
commit | 178bd471d12a88862fb4ac1a17842ea0fd63c160 (patch) (unidiff) | |
tree | c37b10465eca3b6c2431b7999fe32eb4692f12ee | |
parent | 186bdeb08c0d9ccd78177310cf9f69ea80b76a96 (diff) | |
download | opie-178bd471d12a88862fb4ac1a17842ea0fd63c160.zip opie-178bd471d12a88862fb4ac1a17842ea0fd63c160.tar.gz opie-178bd471d12a88862fb4ac1a17842ea0fd63c160.tar.bz2 |
Workaround for a possible race condition in the QWS server (mostly OZ)
(clipboard handling in Qt/E is a mess)
-rw-r--r-- | core/applets/clipboardapplet/clipboard.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp index 4fbdf6f..3099a84 100644 --- a/core/applets/clipboardapplet/clipboard.cpp +++ b/core/applets/clipboardapplet/clipboard.cpp | |||
@@ -127,13 +127,13 @@ ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( | |||
127 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); | 127 | connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( ))); |
128 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); | 128 | connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( ))); |
129 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); | 129 | connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( ))); |
130 | 130 | ||
131 | m_timer-> start ( 1500 ); | ||
132 | |||
133 | m_menu = 0; | 131 | m_menu = 0; |
134 | m_dirty = true; | 132 | m_dirty = true; |
135 | m_lasttext = QString::null; | 133 | m_lasttext = QString::null; |
134 | |||
135 | m_timer-> start ( 0, true ); | ||
136 | } | 136 | } |
137 | 137 | ||
138 | ClipboardApplet::~ClipboardApplet ( ) | 138 | ClipboardApplet::~ClipboardApplet ( ) |
139 | { | 139 | { |
@@ -227,8 +227,17 @@ void ClipboardApplet::paintEvent ( QPaintEvent* ) | |||
227 | } | 227 | } |
228 | 228 | ||
229 | void ClipboardApplet::newData ( ) | 229 | void ClipboardApplet::newData ( ) |
230 | { | 230 | { |
231 | static bool excllock = false; | ||
232 | |||
233 | if ( excllock ) | ||
234 | return; | ||
235 | else | ||
236 | excllock = true; | ||
237 | |||
238 | m_timer-> stop ( ); | ||
239 | |||
231 | QCString type = "plain"; | 240 | QCString type = "plain"; |
232 | QString txt = QApplication::clipboard ( )-> text ( type ); | 241 | QString txt = QApplication::clipboard ( )-> text ( type ); |
233 | 242 | ||
234 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { | 243 | if ( !txt. isEmpty ( ) && !m_history. contains ( txt )) { |
@@ -238,5 +247,9 @@ void ClipboardApplet::newData ( ) | |||
238 | m_history. remove ( m_history. begin ( )); | 247 | m_history. remove ( m_history. begin ( )); |
239 | 248 | ||
240 | m_dirty = true; | 249 | m_dirty = true; |
241 | } | 250 | } |
251 | |||
252 | m_timer-> start ( 1500, true ); | ||
253 | |||
254 | excllock = false; | ||
242 | } | 255 | } |