author | zecke <zecke> | 2005-03-06 23:30:41 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-03-06 23:30:41 (UTC) |
commit | f312f32d624c6198c63890e141e8658bc492cf37 (patch) (side-by-side diff) | |
tree | c76e9caad09226113e42e0477d08e13d6388af2e | |
parent | 578cc81bc489015320351efd4fabcbed3355ac23 (diff) | |
download | opie-f312f32d624c6198c63890e141e8658bc492cf37.zip opie-f312f32d624c6198c63890e141e8658bc492cf37.tar.gz opie-f312f32d624c6198c63890e141e8658bc492cf37.tar.bz2 |
The mainwidget could be deleted before the qpeapplication will be destructed or
the event loop will be left.
Use a QGuardedPtr to not save widget coordinates on a not anymore existing
mainwidget
-rw-r--r-- | library/qpeapplication.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 2bd7cbe..953f9d0 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -158,25 +158,25 @@ public: QString appName; struct QCopRec { QCopRec( const QCString &ch, const QCString &msg, const QByteArray &d ) : channel( ch ), message( msg ), data( d ) { } QCString channel; QCString message; QByteArray data; }; - QWidget* qpe_main_widget; + QGuardedPtr<QWidget> qpe_main_widget; QGuardedPtr<QWidget> lastraised; QQueue<QCopRec> qcopq; QString styleName; QString decorationName; void enqueueQCop( const QCString &ch, const QCString &msg, const QByteArray &data ) { qcopq.enqueue( new QCopRec( ch, msg, data ) ); } void sendQCopQ() { @@ -310,24 +310,27 @@ public: p.setY(0); if ( p.x() + wWidth > maxX ) p.setX( maxX - wWidth ); if ( p.y() + wHeight > maxY ) p.setY( maxY - wHeight ); return TRUE; } static void store_widget_rect(QWidget *w, QString &app) { + if( !w ) + return; + // 350 is the trigger in qwsdefaultdecoration for providing a resize button if ( qApp->desktop()->width() <= 350 ) return; // we use these to map the offset of geometry and pos. ( we can only use normalGeometry to // get the non-maximized version, so we have to do it the hard way ) int offsetX = w->x() - w->geometry().left(); int offsetY = w->y() - w->geometry().top(); QRect r; if ( w->isMaximized() ) r = ( (HackWidget *) w)->normalGeometry(); else |