KeySig *ScoreOrStaffDefAttrInterface::GetKeySigCopy() const { // we should not call it without having checked if a keysig is set if (!m_keySig) return NULL; KeySig *copy = NULL; KeySig *current_keySig = dynamic_cast<KeySig*>(m_keySig); if (current_keySig) { copy = new KeySig(*current_keySig); } else { KeySigAttr *current_attr = dynamic_cast<KeySigAttr*>(m_keySig); copy = new KeySig(current_attr); } assert(copy); copy->SetScoreOrStaffDefAttr(true); return copy; }