1
0
Fork 0

add manual uninstall functions for callback/io-handler objects

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3721
This commit is contained in:
Sebastian Strohhäcker 2011-06-17 14:28:00 +00:00
parent 039e32658a
commit f1d85a3739
4 changed files with 19 additions and 3 deletions

View file

@ -95,6 +95,8 @@ public:
void Install(CallBack_Handler handler,Bitu type,const char* description);
void Install(CallBack_Handler handler,Bitu type,PhysPt addr,const char* description);
void Uninstall();
//Only allocate a callback number
void Allocate(CallBack_Handler handler,const char* description=0);
Bit16u Get_callback() {

View file

@ -59,11 +59,13 @@ public:
class IO_ReadHandleObject: private IO_Base{
public:
void Install(Bitu port,IO_ReadHandler * handler,Bitu mask,Bitu range=1);
void Uninstall();
~IO_ReadHandleObject();
};
class IO_WriteHandleObject: private IO_Base{
public:
void Install(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range=1);
void Uninstall();
~IO_WriteHandleObject();
};

View file

@ -464,7 +464,7 @@ void CALLBACK_RemoveSetup(Bitu callback) {
}
}
CALLBACK_HandlerObject::~CALLBACK_HandlerObject(){
void CALLBACK_HandlerObject::Uninstall(){
if(!installed) return;
if(m_type == CALLBACK_HandlerObject::SETUP) {
if(vectorhandler.installed){
@ -485,6 +485,10 @@ CALLBACK_HandlerObject::~CALLBACK_HandlerObject(){
CALLBACK_DeAllocate(m_callback);
}
CALLBACK_HandlerObject::~CALLBACK_HandlerObject(){
Uninstall();
}
void CALLBACK_HandlerObject::Install(CallBack_Handler handler,Bitu type,const char* description){
if(!installed) {
installed=true;

View file

@ -118,11 +118,15 @@ void IO_ReadHandleObject::Install(Bitu port,IO_ReadHandler * handler,Bitu mask,B
} else E_Exit("IO_readHandler allready installed port %x",port);
}
IO_ReadHandleObject::~IO_ReadHandleObject(){
void IO_ReadHandleObject::Uninstall(){
if(!installed) return;
IO_FreeReadHandler(m_port,m_mask,m_range);
}
IO_ReadHandleObject::~IO_ReadHandleObject(){
Uninstall();
}
void IO_WriteHandleObject::Install(Bitu port,IO_WriteHandler * handler,Bitu mask,Bitu range) {
if(!installed) {
installed=true;
@ -133,9 +137,13 @@ void IO_WriteHandleObject::Install(Bitu port,IO_WriteHandler * handler,Bitu mask
} else E_Exit("IO_writeHandler allready installed port %x",port);
}
IO_WriteHandleObject::~IO_WriteHandleObject(){
void IO_WriteHandleObject::Uninstall() {
if(!installed) return;
IO_FreeWriteHandler(m_port,m_mask,m_range);
}
IO_WriteHandleObject::~IO_WriteHandleObject(){
Uninstall();
//LOG_MSG("FreeWritehandler called with port %X",m_port);
}