File tree 2 files changed +7
-3
lines changed 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 1
1
FormatStyle : file
2
2
3
3
Checks : '
4
- -*,
5
4
llvm-namespace-comment,
6
5
modernize-use-override,
7
6
readability-container-size-empty,
Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ class pythonbuf : public std::streambuf {
38
38
return sync () == 0 ? traits_type::not_eof (c) : traits_type::eof ();
39
39
}
40
40
41
- int sync () override {
41
+ // This function must be non-virtual to be called in a destructor
42
+ int _sync () {
42
43
if (pbase () != pptr ()) {
43
44
// This subtraction cannot be negative, so dropping the sign
44
45
str line (pbase (), static_cast <size_t >(pptr () - pbase ()));
@@ -54,6 +55,10 @@ class pythonbuf : public std::streambuf {
54
55
return 0 ;
55
56
}
56
57
58
+ int sync () override {
59
+ return _sync ();
60
+ }
61
+
57
62
public:
58
63
59
64
pythonbuf (object pyostream, size_t buffer_size = 1024 )
@@ -68,7 +73,7 @@ class pythonbuf : public std::streambuf {
68
73
69
74
// / Sync before destroy
70
75
~pythonbuf () override {
71
- sync ();
76
+ _sync ();
72
77
}
73
78
};
74
79
You can’t perform that action at this time.
0 commit comments