]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/BCView.C
fix crash due to invalidated iterator
[lyx.git] / src / frontends / controllers / BCView.C
1 /**
2  * \file BCView.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "BCView.h"
14 #include "ButtonController.h"
15
16 namespace lyx {
17 namespace frontend {
18
19 CheckedWidget::~CheckedWidget()
20 {}
21
22
23 BCView::BCView(ButtonController const & p)
24         : parent(p)
25 {}
26
27
28 ButtonPolicy & BCView::bp() const
29 {
30         return parent.bp();
31 }
32
33
34 void BCView::addCheckedWidget(CheckedWidget * ptr)
35 {
36         if (ptr)
37                 checked_widgets.push_back(checked_widget_ptr(ptr));
38 }
39
40
41 bool BCView::checkWidgets() const
42 {
43         bool valid = true;
44
45         checked_widget_list::const_iterator it  = checked_widgets.begin();
46         checked_widget_list::const_iterator end = checked_widgets.end();
47
48         for (; it != end; ++it) {
49                 valid &= (*it)->check();
50         }
51
52         // return valid status after checking ALL widgets
53         return valid;
54 }
55
56 } // namespace frontend
57 } // namespace lyx