File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(reso
115
115
116
116
events.precommit .emit ();
117
117
if (pending.rejected ) {
118
+ pending.rejected = false ;
118
119
dropPendingBuffer ();
119
120
return ;
120
121
}
@@ -129,15 +130,20 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(reso
129
130
}
130
131
131
132
// save state while we wait for buffer to become ready
132
- const auto & state = pendingStates.emplace_back (makeUnique<SSurfaceState>(pending));
133
+ const auto & state = pendingStates.emplace (makeUnique<SSurfaceState>(pending));
133
134
pending.reset ();
134
135
135
136
auto whenReadable = [this , surf = self, state = WP<SSurfaceState>(pendingStates.back ())] {
136
137
if (!surf || state.expired ())
137
138
return ;
138
139
139
- surf->commitState (*state);
140
- std::erase (pendingStates, state);
140
+ while (!pendingStates.empty () && pendingStates.front () != state) {
141
+ commitState (*pendingStates.front ());
142
+ pendingStates.pop ();
143
+ }
144
+
145
+ commitState (*pendingStates.front ());
146
+ pendingStates.pop ();
141
147
};
142
148
143
149
if (state->updated .acquire ) {
Original file line number Diff line number Diff line change 9
9
*/
10
10
11
11
#include < vector>
12
+ #include < queue>
12
13
#include < cstdint>
13
14
#include " ../WaylandProtocol.hpp"
14
15
#include " ../../render/Texture.hpp"
@@ -87,7 +88,7 @@ class CWLSurfaceResource {
87
88
} events;
88
89
89
90
SSurfaceState current, pending;
90
- std::vector <UP<SSurfaceState>> pendingStates;
91
+ std::queue <UP<SSurfaceState>> pendingStates;
91
92
92
93
std::vector<SP<CWLCallbackResource>> callbacks;
93
94
WP<CWLSurfaceResource> self;
You can’t perform that action at this time.
0 commit comments