prevent memory leaks when re-adding devices
This commit is contained in:
parent
6038beb4b5
commit
a820edea23
2 changed files with 35 additions and 5 deletions
30
bus.cpp
30
bus.cpp
|
@ -41,6 +41,36 @@ bus::~bus()
|
|||
delete m;
|
||||
}
|
||||
|
||||
void bus::add_cpu(cpu *const c)
|
||||
{
|
||||
delete this->c;
|
||||
this->c = c;
|
||||
}
|
||||
|
||||
void bus::add_tm11(tm_11 *tm11)
|
||||
{
|
||||
delete this->tm11;
|
||||
this->tm11 = tm11;
|
||||
}
|
||||
|
||||
void bus::add_rk05(rk05 *rk05_)
|
||||
{
|
||||
delete this->rk05_;
|
||||
this->rk05_ = rk05_;
|
||||
}
|
||||
|
||||
void bus::add_rl02(rl02 *rl02_)
|
||||
{
|
||||
delete this->rl02_;
|
||||
this->rl02_ = rl02_;
|
||||
}
|
||||
|
||||
void bus::add_tty(tty *tty_)
|
||||
{
|
||||
delete this->tty_;
|
||||
this->tty_ = tty_;
|
||||
}
|
||||
|
||||
void bus::clearmem()
|
||||
{
|
||||
m -> reset();
|
||||
|
|
10
bus.h
10
bus.h
|
@ -110,11 +110,11 @@ public:
|
|||
|
||||
uint16_t get_console_leds() { return console_leds; }
|
||||
|
||||
void add_cpu(cpu *const c) { this -> c = c; }
|
||||
void add_tm11(tm_11 *tm11) { this -> tm11 = tm11; }
|
||||
void add_rk05(rk05 *rk05_) { this -> rk05_ = rk05_; }
|
||||
void add_rl02(rl02 *rl02_) { this -> rl02_ = rl02_; }
|
||||
void add_tty(tty *tty_) { this -> tty_ = tty_; }
|
||||
void add_cpu(cpu *const c);
|
||||
void add_tm11(tm_11 *tm11);
|
||||
void add_rk05(rk05 *rk05_);
|
||||
void add_rl02(rl02 *rl02_);
|
||||
void add_tty(tty *tty_);
|
||||
|
||||
cpu *getCpu() { return this->c; }
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue