Merge pull request #2115 from jpark37/duplicator-ref-count

Fix duplicator ref count
master
Jim 2019-10-10 21:01:16 -07:00 committed by GitHub
commit 29ca28418f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@
******************************************************************************/
#include "d3d11-subsystem.hpp"
#include <map>
#include <unordered_map>
static inline bool get_monitor(gs_device_t *device, int monitor_idx,
IDXGIOutput **dxgiOutput)
@ -122,11 +122,11 @@ EXPORT bool device_get_duplicator_monitor_info(gs_device_t *device,
return true;
}
static std::map<int, gs_duplicator *> instances;
static std::unordered_map<int, gs_duplicator *> instances;
void reset_duplicators(void)
{
for (auto &pair : instances) {
for (std::pair<const int, gs_duplicator *> &pair : instances) {
pair.second->updated = false;
}
}
@ -136,7 +136,7 @@ EXPORT gs_duplicator_t *device_duplicator_create(gs_device_t *device,
{
gs_duplicator *duplicator = nullptr;
auto it = instances.find(monitor_idx);
const auto it = instances.find(monitor_idx);
if (it != instances.end()) {
duplicator = it->second;
duplicator->refs++;

View File

@ -52,7 +52,7 @@ static inline void update_settings(struct duplicator_capture *capture,
obs_enter_graphics();
gs_duplicator_destroy(capture->duplicator);
capture->duplicator = gs_duplicator_create(capture->monitor);
capture->duplicator = NULL;
capture->width = 0;
capture->height = 0;
capture->x = 0;