From a8935efa82457dd8a137224371284776d7024f32 Mon Sep 17 00:00:00 2001
From: Pierre Rossi <pierre.rossi@theqtcompany.com>
Date: Mon, 16 Mar 2015 18:13:19 +0100
Subject: [PATCH] Properly copy the UserScriptData

UserScriptControllerHost keeps a collection of UserScripts
and not the UserScriptData, which is a simple struct intended
to be passed over IPC. Rely on the compiler generated copy
constructor to copy that data.

Change-Id: Ib5479e634f10d3646a10b644b0eaee471e48f5b8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
---
 src/core/user_script.cpp | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp
index 39da059d7..fb293c56a 100644
--- a/src/core/user_script.cpp
+++ b/src/core/user_script.cpp
@@ -55,13 +55,8 @@ UserScript::UserScript(const UserScript &other)
 {
     if (other.isNull())
         return;
-    scriptData.reset(new UserScriptData);
+    scriptData.reset(new UserScriptData(*other.scriptData));
     m_name = other.m_name;
-    scriptData->source = other.scriptData->source;
-    scriptData->url = other.scriptData->url;
-    scriptData->injectionPoint = other.scriptData->injectionPoint;
-    scriptData->injectForSubframes = other.scriptData->injectForSubframes;
-    scriptData->worldId = other.scriptData->worldId;
 }
 
 UserScript::~UserScript()
@@ -75,13 +70,8 @@ UserScript &UserScript::operator=(const UserScript &other)
         m_name = QString();
         return *this;
     }
-    scriptData.reset(new UserScriptData);
+    scriptData.reset(new UserScriptData(*other.scriptData));
     m_name = other.m_name;
-    scriptData->source = other.scriptData->source;
-    scriptData->url = other.scriptData->url;
-    scriptData->injectionPoint = other.scriptData->injectionPoint;
-    scriptData->injectForSubframes = other.scriptData->injectForSubframes;
-    scriptData->worldId = other.scriptData->worldId;
     return *this;
 }
 
-- 
GitLab