Changeset 148202 in webkit
- Timestamp:
- Apr 11, 2013 7:42:14 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148201 r148202 1 2013-04-11 ChangSeok Oh <changseok.oh@collabora.com> 2 3 [GTK][AC] use a smart pointer for GList and ClutterCanvas 4 https://bugs.webkit.org/show_bug.cgi?id=114057 5 6 Reviewed by Gustavo Noronha Silva. 7 8 We can make simple code & prevent possible memory leak by using a proper smart pointer. 9 Especially if we get children by clutter_actor_get_children, we should free it after using. 10 11 No functionality changed. 12 13 * platform/graphics/clutter/GraphicsLayerActor.cpp: 14 (graphicsLayerActorUpdateTexture): 15 (graphicsLayerActorRemoveAll): 16 1 17 2013-04-11 Arvid Nilsson <anilsson@rim.com> 2 18 -
trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp
r147644 r148202 30 30 #include "RefPtrCairo.h" 31 31 #include "TransformationMatrix.h" 32 #include <algorithm> 33 #include <wtf/gobject/GOwnPtr.h> 32 34 #include <wtf/text/CString.h> 33 35 … … 267 269 268 270 ClutterActor* actor = CLUTTER_ACTOR(layer); 269 ClutterContent* canvas = clutter_actor_get_content(actor);271 GRefPtr<ClutterContent> canvas = adoptGRef(clutter_actor_get_content(actor)); 270 272 if (canvas) { 271 273 // Nothing needs a texture, remove the one we have, if any. 272 274 if (!priv->drawsContent && !priv->surface) { 273 g_signal_handlers_disconnect_by_func(canvas , reinterpret_cast<void*>(graphicsLayerActorDraw), layer);275 g_signal_handlers_disconnect_by_func(canvas.get(), reinterpret_cast<void*>(graphicsLayerActorDraw), layer); 274 276 clutter_actor_set_content(actor, 0); 275 277 } … … 278 280 279 281 // We should have a texture, so create one. 280 int width = ceilf(clutter_actor_get_width(actor)); 281 int height = ceilf(clutter_actor_get_height(actor)); 282 283 canvas = clutter_canvas_new(); 284 clutter_actor_set_content(actor, canvas); 285 clutter_canvas_set_size(CLUTTER_CANVAS(canvas), width > 0 ? width : 1, height > 0 ? height : 1); 286 g_object_unref(canvas); 287 288 g_signal_connect(canvas, "draw", G_CALLBACK(graphicsLayerActorDraw), layer); 282 canvas = adoptGRef(clutter_canvas_new()); 283 clutter_actor_set_content(actor, canvas.get()); 284 285 int width = std::max(static_cast<int>(ceilf(clutter_actor_get_width(actor))), 1); 286 int height = std::max(static_cast<int>(ceilf(clutter_actor_get_height(actor))), 1); 287 clutter_canvas_set_size(CLUTTER_CANVAS(canvas.get()), width, height); 288 289 g_signal_connect(canvas.get(), "draw", G_CALLBACK(graphicsLayerActorDraw), layer); 289 290 } 290 291 … … 340 341 g_return_if_fail(GRAPHICS_LAYER_IS_ACTOR(layer)); 341 342 342 G List* children = clutter_actor_get_children(CLUTTER_ACTOR(layer));343 for ( ; children; children = children->next)344 clutter_actor_remove_child(CLUTTER_ACTOR(layer), CLUTTER_ACTOR(child ren->data));343 GOwnPtr<GList> children(clutter_actor_get_children(CLUTTER_ACTOR(layer))); 344 for (GList* child = children.get(); child; child = child->next) 345 clutter_actor_remove_child(CLUTTER_ACTOR(layer), CLUTTER_ACTOR(child->data)); 345 346 } 346 347
Note: See TracChangeset
for help on using the changeset viewer.