Changeset 139 for trunk/include


Ignore:
Timestamp:
Oct 20, 2006, 11:44:52 PM (19 years ago)
Author:
dmik
Message:

Kernel/Tools: Improved OS/2 exception handling:

  • Moved the excpetion handler code from the kernel module to the tools module (defines are now in qt_os2.h instead of qwindowdefs_pm.h);
  • QT_PM_NO_SYSEXCEPTIONS is renamed to QT_OS2_NO_SYSEXCEPTIONS;
  • Added the QtOS2SysXcptMainHandler stack-based class to correctly install the exception handler on the main thread, as well as provide an optional callback.
Location:
trunk/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/qt_os2.h

    r8 r139  
    4545#include <os2.h>
    4646
     47// OS/2 system exception handler callback interface
     48
     49#if !defined(QT_OS2_NO_SYSEXCEPTIONS)
     50
     51enum QtOS2SysXcptReq
     52{
     53    QtOS2SysXcptReq_AppName = 0,
     54    QtOS2SysXcptReq_AppVer = 1,
     55    QtOS2SysXcptReq_ReportTo = 2,
     56    QtOS2SysXcptReq_ReportSubj = 3,
     57};
     58
     59typedef void (*QtOS2SysXcptWriter)( const char *str );
     60typedef int (*QtOS2SysXcptCallback)( QtOS2SysXcptReq req,
     61                                     QtOS2SysXcptWriter writer,
     62                                     int reserved );
     63
     64class Q_EXPORT QtOS2SysXcptMainHandler
     65{
     66public:
     67    QtOS2SysXcptMainHandler( QtOS2SysXcptCallback cb = NULL );
     68    ~QtOS2SysXcptMainHandler();
     69
     70    class Private;
     71   
     72private:
     73    EXCEPTIONREGISTRATIONRECORD rec;
     74   
     75    static bool installed;
     76    static QtOS2SysXcptCallback callback;
     77    static ERR libcHandler;
     78
     79    static ULONG APIENTRY handler( PEXCEPTIONREPORTRECORD pReportRec,
     80                                   PEXCEPTIONREGISTRATIONRECORD pRegRec,
     81                                   PCONTEXTRECORD pContextRec,
     82                                   PVOID pv );
     83
     84    friend class QtOS2SysXcptMainHandlerInternal;
     85    friend class QThreadInstance;
     86
     87    // these are private to allow only stack-based instances   
     88    QtOS2SysXcptMainHandler( QtOS2SysXcptMainHandler &/*that*/ ) {}
     89    QtOS2SysXcptMainHandler &operator =( QtOS2SysXcptMainHandler &/*that*/) {
     90        return *this;
     91    }
     92    static void *operator new( size_t /*size*/ ) throw() { return NULL; }
     93    static void operator delete( void */*memory*/ ) {}   
     94};
     95
     96#endif // !defined(QT_OS2_NO_SYSEXCEPTIONS)
     97
    4798#endif // QT_OS2_H
  • trunk/include/qwindowdefs_pm.h

    r136 r139  
    124124};
    125125
    126 // OS/2 system exception handler callback interface
    127 
    128 enum QtSysXcptReq
    129 {
    130     QtSysXcptReq_AppName = 0,
    131     QtSysXcptReq_AppVer = 1,
    132     QtSysXcptReq_ReportTo = 2,
    133     QtSysXcptReq_ReportSubj = 3,
    134 };
    135 
    136 typedef void (*QtSysXcptWriter)( const char *str );
    137 typedef int (*QtSysXcptCallback)( QtSysXcptReq req, QtSysXcptWriter writer,
    138                                   int reserved );
    139 
    140 Q_EXPORT QtSysXcptCallback qInstallSysXcptCallback( QtSysXcptCallback cb );
    141 
    142126#endif
Note: See TracChangeset for help on using the changeset viewer.