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

List:       kde-core-devel
Subject:    Re: shutdown signal of kapp <> dcopserver
From:       Simon Hausmann <shaus () helios ! Med ! Uni-Magdeburg ! DE>
Date:       2000-08-01 11:02:29
[Download RAW message or body]

On Tue, 1 Aug 2000, Matthias Ettrich wrote:
> > Can anyone confirm that? Any ideas how to solve this? Define a new ICE error
> > handler which just...does "almost" nothing?
> 
> Yes. You may want to call the ICE error handler that was installed previously
> from your handler, though.

Okay, I attached a patch. Can some kapp/ice expert please review it?

(it works for me (meaning kdesky saves the icon positions again :) ), but
one never knows.. :)

Thanks.

Bye,
 Simon

["kapp_ice_patch.txt" (TEXT/PLAIN)]

Index: kapp.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kapp.cpp,v
retrieving revision 1.363
diff -u -b -p -r1.363 kapp.cpp
--- kapp.cpp	2000/07/30 19:15:40	1.363
+++ kapp.cpp	2000/08/01 10:53:57
@@ -95,6 +95,7 @@
 #include <X11/Xutil.h>
 #include <X11/Xatom.h>
 #include <X11/SM/SMlib.h>
+#include <X11/ICE/ICElib.h>
 
 // defined by X11 headers
 const int XKeyPress = KeyPress;
@@ -125,6 +126,12 @@ static int kde_x_errhandler( Display *dp
         qWarning( "KDE detected X Error: %s %d\n  Major opcode:  %d", errstr, \
err->error_code, err->request_code );  return 0;
 }
+
+static void kde_ice_ioerrorhandler( IceConn conn )
+{
+    kapp->iceIOErrorHandler( conn );
+}
+
 }
 
 /*
@@ -136,6 +143,7 @@ public:
   KApplicationPrivate()
   {
     refCount = 1;
+    oldIceIOErrorHandler = 0;
   }
 
   ~KApplicationPrivate()
@@ -148,6 +156,8 @@ public:
    * (e.g. a file copy for a file manager, or 'compacting folders on exit' for a \
                mail client).
    */
   int refCount;
+
+  IceIOErrorHandler oldIceIOErrorHandler;
 };
 
 
@@ -256,6 +266,16 @@ int KApplication::xioErrhandler()
   return 0;
 }
 
+void KApplication::iceIOErrorHandler( _IceConn *conn )
+{
+    emit shutDown();
+
+    if ( d->oldIceIOErrorHandler != NULL )
+      (*d->oldIceIOErrorHandler)( conn );
+
+    exit( 1 );
+}
+
 class KDETranslator : public QTranslator
 {
 public:
@@ -325,6 +345,8 @@ void KApplication::init(bool GUIenabled)
     XChangeProperty(qt_xdisplay(), smw->winId(), a, a, 32,
                                         PropModeReplace, (unsigned char *)&data, 1);
   }
+
+  d->oldIceIOErrorHandler = IceSetIOErrorHandler( kde_ice_ioerrorhandler );
 }
 
 static int my_system (const char *command) {
@@ -812,6 +834,9 @@ KApplication::~KApplication()
   KProcessController* ctrl = KProcessController::theKProcessController;
   KProcessController::theKProcessController = 0;
   delete ctrl; // Stephan: "there can be only one" ;)
+
+  if ( d->oldIceIOErrorHandler != NULL )
+      IceSetIOErrorHandler( d->oldIceIOErrorHandler );
 
   delete d;
   KApp = 0;
Index: kapp.h
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kapp.h,v
retrieving revision 1.177
diff -u -b -p -r1.177 kapp.h
--- kapp.h	2000/07/21 18:26:10	1.177
+++ kapp.h	2000/08/01 10:54:00
@@ -43,6 +43,7 @@ typedef unsigned long Atom;
 #include <qpixmap.h>
 #include <kinstance.h>
 
+struct _IceConn;
 class QPopupMenu;
 class QStrList;
 class KSessionManaged;
@@ -573,6 +574,11 @@ public:
       @internal
     */
   int xioErrhandler();
+
+  /**
+   * @internal
+   */
+  void iceIOErrorHandler( _IceConn *conn );
 
   /**
    * @internal



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

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