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

List:       kde-commits
Subject:    kdebase/klipper
From:       Luboš Luňák <l.lunak () kde ! org>
Date:       2004-11-11 13:31:30
Message-ID: 20041111133130.EDFA416DC6 () office ! kde ! org
[Download RAW message or body]

CVS commit by lunakl: 

BUG: 84273


  M +15 -4     applet.cpp   1.10
  M +2 -1      applet.h   1.9


--- kdebase/klipper/applet.cpp  #1.9:1.10
@@ -93,5 +93,13 @@ void KlipperApplet::about()
 
 KlipperAppletWidget::KlipperAppletWidget( QWidget* parent )
-    : KlipperWidget( parent, new KConfig( "klipperrc" ))
+// init() is called first, before KlipperWidget is called with ( parent, kconfig )
+    : KlipperWidget( ( init(), parent ), new KConfig( "klipperrc" ))
+{
+}
+
+// this needs to be called before KlipperWidget ctor, because it performs already some
+// operations with the clipboard, and the other running instance could notice that
+// and request data while this instance is waiting in the DCOP call
+void KlipperAppletWidget::init()
 {
     // if there's klipper process running, quit it
@@ -102,13 +110,16 @@ KlipperAppletWidget::KlipperAppletWidget
     // register ourselves, so if klipper process is started,
     // it will quit immediately (KUniqueApplication)
-    m_dcop = new DCOPClient;
-    m_dcop->registerAs( "klipper", false );
+    s_dcop = new DCOPClient;
+    s_dcop->registerAs( "klipper", false );
 }
 
 KlipperAppletWidget::~KlipperAppletWidget()
 {
-    delete m_dcop;
+    delete s_dcop;
+    s_dcop = 0;
 }
 
+DCOPClient* KlipperAppletWidget::s_dcop = 0;
+
 // this is just to make klipper process think we're KUniqueApplication
 // (AKA ugly hack)

--- kdebase/klipper/applet.h  #1.8:1.9
@@ -52,5 +52,6 @@ public:
     virtual ~KlipperAppletWidget();
 private:
-    DCOPClient* m_dcop;
+    void init();
+    static DCOPClient* s_dcop;
 
 };


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

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