]> git.lyx.org Git - features.git/commitdiff
One should use dynamic_casts for inheritance-based casting.
authorVincent van Ravesteijn <vfr@lyx.org>
Mon, 25 Oct 2010 09:49:24 +0000 (09:49 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Mon, 25 Oct 2010 09:49:24 +0000 (09:49 +0000)
(This is a little necessary clean-up of my tree.)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35817 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp

index 3eae06e13c0f0e8aab399ed5bfecbf17e652738a..0013804d77aa5e0b30af8eb5d17b7fa442edcb23 100644 (file)
@@ -2090,7 +2090,7 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                bool success = false;
                for (; it != end; ++it) {
                        if (it->lyxCode() == BRANCH_CODE) {
-                               InsetBranch & ins = static_cast<InsetBranch &>(*it);
+                               InsetBranch & ins = dynamic_cast<InsetBranch &>(*it);
                                if (ins.branch() == oldname) {
                                        undo().recordUndo(it);
                                        ins.rename(newname);
@@ -2835,7 +2835,7 @@ void Buffer::getUsedBranches(std::list<docstring> & result, bool const from_mast
        InsetIterator const end = inset_iterator_end(inset());
        for (; it != end; ++it) {
                if (it->lyxCode() == BRANCH_CODE) {
-                       InsetBranch & br = static_cast<InsetBranch &>(*it);
+                       InsetBranch & br = dynamic_cast<InsetBranch &>(*it);
                        docstring const name = br.branch();
                        if (!from_master && !params().branchlist().find(name))
                                result.push_back(name);