Bug fix : Qet crash when load a conductor without two terminal (because the allocation of a new conductor fail)

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3974 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
blacksun
2015-05-18 22:19:14 +00:00
parent e73bad2bd6
commit 4142f9c6a2
3 changed files with 29 additions and 11 deletions

View File

@@ -59,12 +59,11 @@ Conductor::Conductor(Terminal *p1, Terminal* p2) :
setZValue(9);
previous_z_value = zValue();
// ajout du conducteur a la liste de conducteurs de chacune des deux bornes
//Add this conductor to the list of conductor of each of the two terminal
bool ajout_p1 = terminal1 -> addConductor(this);
bool ajout_p2 = terminal2 -> addConductor(this);
// en cas d'echec de l'ajout (conducteur deja existant notamment)
if (!ajout_p1 || !ajout_p2) return;
//m_valid become false if the conductor can't be added to terminal (conductor already exist)
m_valid = (!ajout_p1 || !ajout_p2) ? false : true;
// attributs de dessin par defaut (communs a tous les conducteurs)
if (!pen_and_brush_initialized) {
@@ -113,6 +112,15 @@ Conductor::~Conductor() {
deleteSegments();
}
/**
* @brief Conductor::isValid
* @return true if conductor is valid else false;
* A non valid conductor, is a conductor without two terminal
*/
bool Conductor::isValid() const {
return m_valid;
}
/**
Met a jour la representation graphique du conducteur en recalculant son
trace. Cette fonction est typiquement appelee lorsqu'une seule des bornes du