Fix assertions in debug builds for the GTK+ port.
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 May 2016 15:31:16 +0000 (15:31 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 May 2016 15:31:16 +0000 (15:31 +0000)
Rubber-stamped by Carlos Garcia Campos.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData):
Switch back to the find() + add() combo for retrieving the pointer
to the SharedGLData object stored for the specific GraphicsContext3D.
add() + isNewEntry is causing assertions in debug builds when adding
the first entry.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200456 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp

index 01d5884..bedac3e 100644 (file)
@@ -1,3 +1,16 @@
+2016-05-05  Zan Dobersek  <zdobersek@igalia.com>
+
+        Fix assertions in debug builds for the GTK+ port.
+
+        Rubber-stamped by Carlos Garcia Campos.
+
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData):
+        Switch back to the find() + add() combo for retrieving the pointer
+        to the SharedGLData object stored for the specific GraphicsContext3D.
+        add() + isNewEntry is causing assertions in debug builds when adding
+        the first entry.
+
 2016-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GStreamer] Adaptive streaming issues
index 55a135c..6439916 100644 (file)
@@ -76,15 +76,13 @@ private:
     public:
         static Ref<SharedGLData> currentSharedGLData(GraphicsContext3D& context)
         {
-            RefPtr<SharedGLData> data;
-            auto addResult = contextDataMap().add(context.platformGraphicsContext3D(), nullptr);
-            if (addResult.isNewEntry) {
-                data = adoptRef(new SharedGLData(context));
-                addResult.iterator->value = data.get();
-            } else
-                data = addResult.iterator->value;
-
-            return *data;
+            auto it = contextDataMap().find(context.platformGraphicsContext3D());
+            if (it != contextDataMap().end())
+                return *it->value;
+
+            Ref<SharedGLData> data = adoptRef(*new SharedGLData(context));
+            contextDataMap().add(context.platformGraphicsContext3D(), data.ptr());
+            return data;
         }
 
         ~SharedGLData()