summaryrefslogtreecommitdiff
authorsandman <sandman>2002-07-28 00:44:43 (UTC)
committer sandman <sandman>2002-07-28 00:44:43 (UTC)
commit72081cbfef03a69ed6f9ca7826854b6cf10dc2fe (patch) (side-by-side diff)
tree43e67bdc7cbb972f431b3912e2f068df3d2c97bf
parent4baf36396739502c5471950e29f18954cca4517b (diff)
downloadopie-72081cbfef03a69ed6f9ca7826854b6cf10dc2fe.zip
opie-72081cbfef03a69ed6f9ca7826854b6cf10dc2fe.tar.gz
opie-72081cbfef03a69ed6f9ca7826854b6cf10dc2fe.tar.bz2
Workaround for a weird Qt/E bug, resulting in qpe hanging if clipboard
applet is loaded and qpe is terminated via shutdown applet.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/clipboardapplet/clipboard.cpp15
-rw-r--r--core/applets/clipboardapplet/clipboard.h4
-rw-r--r--core/launcher/desktop.cpp6
3 files changed, 22 insertions, 3 deletions
diff --git a/core/applets/clipboardapplet/clipboard.cpp b/core/applets/clipboardapplet/clipboard.cpp
index 5848d0f..4fbdf6f 100644
--- a/core/applets/clipboardapplet/clipboard.cpp
+++ b/core/applets/clipboardapplet/clipboard.cpp
@@ -113,40 +113,49 @@ static const char * paste_xpm[] = {
"<cyyymk))p(%q.",
",5vvv4k)p_%[q.",
" ...$mljnn0qd.",
" 4.......,"};
ClipboardApplet::ClipboardApplet( QWidget *parent, const char *name ) : QWidget( parent, name )
{
setFixedWidth ( 14 );
setFixedHeight ( 18 );
m_clipboardPixmap = QPixmap ( paste_xpm );
- QTimer *timer = new QTimer ( this );
+ m_timer = new QTimer ( this );
connect ( QApplication::clipboard ( ), SIGNAL( dataChanged ( )), this, SLOT( newData ( )));
- connect ( timer, SIGNAL( timeout ( )), this, SLOT( newData ( )));
+ connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( newData ( )));
+ connect ( qApp, SIGNAL( aboutToQuit ( )), this, SLOT( shutdown ( )));
- timer-> start ( 1000 );
+ m_timer-> start ( 1500 );
m_menu = 0;
m_dirty = true;
m_lasttext = QString::null;
}
ClipboardApplet::~ClipboardApplet ( )
{
}
+void ClipboardApplet::shutdown ( )
+{
+ // the timer has to be stopped, or Qt/E will hang on quit()
+ // see launcher/desktop.cpp
+
+ m_timer-> stop ( );
+}
+
void ClipboardApplet::mousePressEvent ( QMouseEvent *)
{
if ( m_dirty ) {
delete m_menu;
m_menu = new QPopupMenu ( this );
m_menu-> setCheckable ( true );
if ( m_history. count ( )) {
for ( unsigned int i = 0; i < m_history. count ( ); i++ ) {
QString str = m_history [i];
diff --git a/core/applets/clipboardapplet/clipboard.h b/core/applets/clipboardapplet/clipboard.h
index 84743d9..ec87d39 100644
--- a/core/applets/clipboardapplet/clipboard.h
+++ b/core/applets/clipboardapplet/clipboard.h
@@ -15,39 +15,43 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef __CLIPBOARD_APPLET_H__
#define __CLIPBOARD_APPLET_H__
#include <qwidget.h>
#include <qpixmap.h>
#include <qstringlist.h>
+class QTimer;
+
class ClipboardApplet : public QWidget
{
Q_OBJECT
public:
ClipboardApplet ( QWidget *parent = 0, const char *name=0 );
~ClipboardApplet ( );
protected:
void mousePressEvent ( QMouseEvent *);
void paintEvent ( QPaintEvent* );
private slots:
void action ( int );
void newData ( );
+ void shutdown ( );
private:
QPopupMenu * m_menu;
QStringList m_history;
bool m_dirty;
QString m_lasttext;
+ QTimer * m_timer;
QPixmap m_clipboardPixmap;
};
#endif // __CLIPBOARD_APPLET_H__
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index e58b08c..f90da1a 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -677,24 +677,30 @@ void DesktopApplication::shutdown( ShutdownImpl::Type t )
switch ( t ) {
case ShutdownImpl::ShutdownSystem:
execlp("shutdown", "shutdown", "-h", "now", (void*)0);
break;
case ShutdownImpl::RebootSystem:
execlp("shutdown", "shutdown", "-r", "now", (void*)0);
break;
case ShutdownImpl::RestartDesktop:
restart();
break;
case ShutdownImpl::TerminateDesktop:
prepareForTermination(FALSE);
+
+ // This is a workaround for a Qt bug
+ // clipboard applet has to stop its poll timer, or Qt/E
+ // will hang on quit() right before it emits aboutToQuit()
+ emit aboutToQuit ( );
+
quit();
break;
}
}
void DesktopApplication::restart()
{
prepareForTermination(TRUE);
#ifdef Q_WS_QWS
for ( int fd = 3; fd < 100; fd++ )
close( fd );