Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArticleViewSearch: Fix calling virtual function from the destructor #280

Conversation

ma8ma
Copy link
Collaborator

@ma8ma ma8ma commented May 16, 2020

ArticleViewSearchはデストラクタ内で仮想関数stop()を呼び出していますが、仮想関数はデストラクタ内で派生クラスの関数として呼び出しできないためcppcheckに警告されます。
そのためスコープ解決演算子を使ってクラスを明示します。

cppcheckのレポート

src/article/articleviewsearch.h:49:14: warning: Virtual function 'stop' is called from destructor '~ArticleViewSearch()' at line 62. Dynamic binding is not used. [virtualCallInConstructor]
        void stop() override;
             ^
src/article/articleviewsearch.cpp:62:5: note: Calling stop
    stop();
    ^
src/article/articleviewsearch.h:49:14: note: stop is a virtual function
        void stop() override;
             ^

ArticleViewSearchはデストラクタ内で仮想関数stop()を呼び出していますが
仮想関数はデストラクタ内で派生クラスの関数として呼び出しできないため
cppcheckに警告されます。そのためスコープ解決演算子を使ってクラスを
明示します。

cppcheckのレポート
```
src/article/articleviewsearch.h:49:14: warning: Virtual function 'stop' is called from destructor '~ArticleViewSearch()' at line 62. Dynamic binding is not used. [virtualCallInConstructor]
        void stop() override;
             ^
src/article/articleviewsearch.cpp:62:5: note: Calling stop
    stop();
    ^
src/article/articleviewsearch.h:49:14: note: stop is a virtual function
        void stop() override;
             ^
```
@ma8ma ma8ma added the bug バグの追跡 label May 16, 2020
@ma8ma ma8ma added this to In progress in State of JDim-v0.3.0+ May 16, 2020
@ma8ma ma8ma merged commit 2450c5f into JDimproved:master May 16, 2020
State of JDim-v0.3.0+ automation moved this from In progress to Done May 16, 2020
@ma8ma ma8ma deleted the articleviewsearch-fix-calling-virtual-function-from-dtor branch May 16, 2020 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug バグの追跡
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

1 participant