webengine/widgetengine/src/WidgetEventHandler.cpp
changeset 5 10e98eab6f85
parent 0 dd21522fd290
equal deleted inserted replaced
1:7c90e6132015 5:10e98eab6f85
    15 *
    15 *
    16 */
    16 */
    17 #include "WidgetEventHandler.h"
    17 #include "WidgetEventHandler.h"
    18 #include "config.h"
    18 #include "config.h"
    19 #include <kjs/object.h>
    19 #include <kjs/object.h>
       
    20 #include "WidgetJSObjectProtector.h"
    20 
    21 
    21 // ============================ MEMBER FUNCTIONS ===============================
    22 // ============================ MEMBER FUNCTIONS ===============================
    22 using namespace KJS;
    23 using namespace KJS;
    23 
    24 
    24 
    25 
    26 // WidgetEventHandler::WidgetEventHandler
    27 // WidgetEventHandler::WidgetEventHandler
    27 //
    28 //
    28 //
    29 //
    29 //
    30 //
    30 // ----------------------------------------------------------------------------
    31 // ----------------------------------------------------------------------------
    31 WidgetEventHandler::WidgetEventHandler( JSValue* aValue, ExecState* aExecState ) : iGlobalExecState (aExecState)
    32 WidgetEventHandler::WidgetEventHandler( JSValue* aValue, ExecState* aExecState, MJSObjectProtector* aProtector) : iGlobalExecState (aExecState), iProtector(aProtector)
    32 {
    33 {
    33     iEventHandler = aValue;
    34     iEventHandler = aValue;
    34     Collector::protect(iEventHandler);    
    35     if(iProtector)
       
    36         {
       
    37 	    iProtector->Protect(iEventHandler);
       
    38 	    }
    35 }
    39 }
    36 
    40 
    37 
    41 
    38 // ----------------------------------------------------------------------------
    42 // ----------------------------------------------------------------------------
    39 // WidgetEventHandler::~WidgetEventHandler
    43 // WidgetEventHandler::~WidgetEventHandler
    41 //
    45 //
    42 //
    46 //
    43 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    44 WidgetEventHandler::~WidgetEventHandler()
    48 WidgetEventHandler::~WidgetEventHandler()
    45 {
    49 {
    46     Collector::unprotect(iEventHandler);
    50     if(iProtector) 
       
    51         {
       
    52 	    iProtector->Unprotect(iEventHandler);
       
    53 	    }
    47 }
    54 }
    48 
    55 
    49 // ----------------------------------------------------------------------------
    56 // ----------------------------------------------------------------------------
    50 // WidgetEventHandler::Delete
    57 // WidgetEventHandler::Delete
    51 // Delete event handler if it isn't handling an event
    58 // Delete event handler if it isn't handling an event