When disconnecting a fake card and replacing it with an SRT card
(or, theoretically, vice versa), we'd delete the old frames assuming
the old pixel format, which would cause us to delete garbage data
and eventually (seemingly?) use deleted texture numbers, causing
GL errors and thus crashes.
- size_t old_num_queued_frames = this->num_queued_frames;
+ lock_guard<mutex> lock(freelist_mutex);
+ lingering_generations[generation] = LingeringGeneration{ move(userdata), this->num_queued_frames };
+ ++generation;
+
+ while (!freelist.empty()) {
+ Frame frame = freelist.front();
+ freelist.pop();
+ destroy_frame(&frame);
+ }
this->pixel_format = pixel_format;
this->frame_size = frame_size;
this->pixel_format = pixel_format;
this->frame_size = frame_size;
this->permissions = permissions;
this->map_bits = map_bits;
this->permissions = permissions;
this->map_bits = map_bits;
- lock_guard<mutex> lock(freelist_mutex);
- lingering_generations[generation] = LingeringGeneration{ move(userdata), old_num_queued_frames };
- ++generation;
-
- while (!freelist.empty()) {
- Frame frame = freelist.front();
- freelist.pop();
- destroy_frame(&frame);
- }
-
userdata.reset(new Userdata[num_queued_frames]);
for (size_t i = 0; i < num_queued_frames; ++i) {
init_frame(i, frame_size, width, height, permissions, map_bits, generation);
userdata.reset(new Userdata[num_queued_frames]);
for (size_t i = 0; i < num_queued_frames; ++i) {
init_frame(i, frame_size, width, height, permissions, map_bits, generation);