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
115115
116116 events.precommit .emit ();
117117 if (pending.rejected ) {
118+ pending.rejected = false ;
118119 dropPendingBuffer ();
119120 return ;
120121 }
@@ -129,15 +130,20 @@ CWLSurfaceResource::CWLSurfaceResource(SP<CWlSurface> resource_) : resource(reso
129130 }
130131
131132 // 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));
133134 pending.reset ();
134135
135136 auto whenReadable = [this , surf = self, state = WP<SSurfaceState>(pendingStates.back ())] {
136137 if (!surf || state.expired ())
137138 return ;
138139
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 ();
141147 };
142148
143149 if (state->updated .acquire ) {
Original file line number Diff line number Diff line change 99*/
1010
1111#include < vector>
12+ #include < queue>
1213#include < cstdint>
1314#include " ../WaylandProtocol.hpp"
1415#include " ../../render/Texture.hpp"
@@ -87,7 +88,7 @@ class CWLSurfaceResource {
8788 } events;
8889
8990 SSurfaceState current, pending;
90- std::vector <UP<SSurfaceState>> pendingStates;
91+ std::queue <UP<SSurfaceState>> pendingStates;
9192
9293 std::vector<SP<CWLCallbackResource>> callbacks;
9394 WP<CWLSurfaceResource> self;
You can’t perform that action at this time.
0 commit comments