Fix segmentation fault due to calling methods on NULL ReadyBatch Object

This commit is contained in:
Thanh C. Tran
2017-05-09 23:23:44 +02:00
parent 7d15ebc45e
commit 92bd873a3e
3 changed files with 7 additions and 0 deletions

View File

@@ -133,6 +133,11 @@ bool SMS::selectSJF(sc_time memClk, std::map<Thread, ReadyBatch*>::iterator &las
bool SMS::selectRR(sc_time memClk, std::map<Thread, ReadyBatch*>::iterator &nextSelectedThread)
{
// no request for this channel, the readybatches map is empty then return
if (readybatches.empty()) {
return false;
}
// pick a non-empty ready batch
std::map<Thread, ReadyBatch*>::iterator savedOriginalNextSelectedThread = nextSelectedThread;
while ((*nextSelectedThread).second->isEmpty())

View File

@@ -43,6 +43,7 @@ class TracePlayerListener
public:
virtual void tracePlayerTerminates() = 0;
virtual void transactionFinished() = 0;
virtual ~TracePlayerListener(){};
};
#endif // TRACEPLAYERLISTENER_H

View File

@@ -53,6 +53,7 @@ public:
virtual void tracePlayerTerminates() override;
virtual void transactionFinished() override;
virtual ~traceSetup(){};
private:
unsigned int NumberOfTracePlayers;