Fixed crash with adding DBC signals, slight code change for clarity in
DBC code
This commit is contained in:
+4
-4
@@ -451,7 +451,7 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
|
|||||||
QRegularExpressionMatch match;
|
QRegularExpressionMatch match;
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
bool isMultiplexor = false;
|
bool isMessageMultiplexor = false;
|
||||||
//bool isMultiplexed = false;
|
//bool isMultiplexed = false;
|
||||||
DBC_SIGNAL sig;
|
DBC_SIGNAL sig;
|
||||||
|
|
||||||
@@ -467,7 +467,7 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
|
|||||||
if (match.hasMatch())
|
if (match.hasMatch())
|
||||||
{
|
{
|
||||||
qDebug() << "Multiplexor signal";
|
qDebug() << "Multiplexor signal";
|
||||||
isMultiplexor = true;
|
isMessageMultiplexor = true;
|
||||||
sig.isMultiplexor = true;
|
sig.isMultiplexor = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -490,7 +490,7 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
|
|||||||
if (match.hasMatch())
|
if (match.hasMatch())
|
||||||
{
|
{
|
||||||
qDebug() << "Extended Multiplexor Signal";
|
qDebug() << "Extended Multiplexor Signal";
|
||||||
sig.isMultiplexor = true; //we don't set the local isMultiplexor variable because this isn't the top level multiplexor
|
sig.isMultiplexor = true; //we don't set the local isMessageMultiplexor variable because this isn't the top level multiplexor
|
||||||
sig.isMultiplexed = true; //but, it is both a multiplexor and multiplexed
|
sig.isMultiplexed = true; //but, it is both a multiplexor and multiplexed
|
||||||
sig.multiplexLowValue = match.captured(2).toInt();
|
sig.multiplexLowValue = match.captured(2).toInt();
|
||||||
sig.multiplexHighValue = sig.multiplexLowValue;
|
sig.multiplexHighValue = sig.multiplexLowValue;
|
||||||
@@ -575,7 +575,7 @@ DBC_SIGNAL* DBCFile::parseSignalLine(QString line, DBC_MESSAGE *msg)
|
|||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
msg->sigHandler->addSignal(sig);
|
msg->sigHandler->addSignal(sig);
|
||||||
if (isMultiplexor) msg->multiplexorSignal = msg->sigHandler->findSignalByName(sig.name);
|
if (isMessageMultiplexor) msg->multiplexorSignal = msg->sigHandler->findSignalByName(sig.name);
|
||||||
return msg->sigHandler->findSignalByName(sig.name);
|
return msg->sigHandler->findSignalByName(sig.name);
|
||||||
}
|
}
|
||||||
else return nullptr;
|
else return nullptr;
|
||||||
|
|||||||
@@ -602,6 +602,7 @@ void DBCMainEditor::newSignal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
sig.parentMessage = msg;
|
sig.parentMessage = msg;
|
||||||
|
if (!sig.receiver) sig.receiver = &dbcFile->dbc_nodes[0]; //if receiver not set then set it to... something.
|
||||||
msg->sigHandler->addSignal(sig);
|
msg->sigHandler->addSignal(sig);
|
||||||
sigPtr = msg->sigHandler->findSignalByIdx(msg->sigHandler->getCount() - 1);
|
sigPtr = msg->sigHandler->findSignalByIdx(msg->sigHandler->getCount() - 1);
|
||||||
QTreeWidgetItem *newSigItem = new QTreeWidgetItem();
|
QTreeWidgetItem *newSigItem = new QTreeWidgetItem();
|
||||||
|
|||||||
Reference in New Issue
Block a user