Browse Source

Do not modify gs_init_data parameter in gs_create

jp9000 11 years ago
parent
commit
05ac1aea2c
1 changed files with 4 additions and 3 deletions
  1. 4 3
      libobs/graphics/graphics.c

+ 4 - 3
libobs/graphics/graphics.c

@@ -119,13 +119,14 @@ static bool graphics_init(struct graphics_subsystem *graphics)
 int gs_create(graphics_t **pgraphics, const char *module,
 		struct gs_init_data *data)
 {
+	struct gs_init_data new_data = *data;
 	int errcode = GS_ERROR_FAIL;
 
 	graphics_t *graphics = bzalloc(sizeof(struct graphics_subsystem));
 	pthread_mutex_init_value(&graphics->mutex);
 
-	if (!data->num_backbuffers)
-		data->num_backbuffers = 1;
+	if (!new_data.num_backbuffers)
+		new_data.num_backbuffers = 1;
 
 	graphics->module = os_dlopen(module);
 	if (!graphics->module) {
@@ -137,7 +138,7 @@ int gs_create(graphics_t **pgraphics, const char *module,
 	                           module))
 		goto error;
 
-	errcode = graphics->exports.device_create(&graphics->device, data);
+	errcode = graphics->exports.device_create(&graphics->device, &new_data);
 	if (errcode != GS_SUCCESS)
 		goto error;