summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 16:19:50 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 16:19:50 +0000
commitdc7364f1c2f0c9fa29c5dad211892f45e31c9b6e (patch)
tree2b164f6a545bccc194c7296e7132c4f396575f66
parentb496d4cf358c721f7cce8079f41b0bde34ec3bb3 (diff)
downloadchromium_src-dc7364f1c2f0c9fa29c5dad211892f45e31c9b6e.zip
chromium_src-dc7364f1c2f0c9fa29c5dad211892f45e31c9b6e.tar.gz
chromium_src-dc7364f1c2f0c9fa29c5dad211892f45e31c9b6e.tar.bz2
Fix a memory corruption issue (use of scoped_ptr instead of scoped_refptr), and
allow for a module that fails to load. R=brettw BUG=none TEST=none Review URL: http://codereview.chromium.org/2072001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47148 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/plugins/pepper_device_context_2d.cc4
-rw-r--r--webkit/glue/plugins/pepper_device_context_2d.h3
-rw-r--r--webkit/glue/plugins/pepper_webplugin_impl.cc6
3 files changed, 7 insertions, 6 deletions
diff --git a/webkit/glue/plugins/pepper_device_context_2d.cc b/webkit/glue/plugins/pepper_device_context_2d.cc
index 0ccba5c..964c605 100644
--- a/webkit/glue/plugins/pepper_device_context_2d.cc
+++ b/webkit/glue/plugins/pepper_device_context_2d.cc
@@ -75,10 +75,10 @@ const PPB_DeviceContext2D* DeviceContext2D::GetInterface() {
}
bool DeviceContext2D::Init(int width, int height) {
- image_data_.reset(new ImageData(module()));
+ image_data_ = new ImageData(module());
if (!image_data_->Init(PP_IMAGEDATAFORMAT_BGRA_PREMUL, width, height) ||
!image_data_->Map()) {
- image_data_.reset();
+ image_data_ = NULL;
return false;
}
diff --git a/webkit/glue/plugins/pepper_device_context_2d.h b/webkit/glue/plugins/pepper_device_context_2d.h
index 8f40692..5e8a877 100644
--- a/webkit/glue/plugins/pepper_device_context_2d.h
+++ b/webkit/glue/plugins/pepper_device_context_2d.h
@@ -6,7 +6,6 @@
#define WEBKIT_GLUE_PLUGINS_PEPPER_DEVICE_CONTEXT_2D_H_
#include "base/basictypes.h"
-#include "base/scoped_ptr.h"
#include "third_party/ppapi/c/ppb_device_context_2d.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h"
#include "webkit/glue/plugins/pepper_resource.h"
@@ -48,7 +47,7 @@ class DeviceContext2D : public Resource {
const gfx::Rect& paint_rect);
private:
- scoped_ptr<ImageData> image_data_;
+ scoped_refptr<ImageData> image_data_;
DISALLOW_COPY_AND_ASSIGN(DeviceContext2D);
};
diff --git a/webkit/glue/plugins/pepper_webplugin_impl.cc b/webkit/glue/plugins/pepper_webplugin_impl.cc
index fa20107..990a885 100644
--- a/webkit/glue/plugins/pepper_webplugin_impl.cc
+++ b/webkit/glue/plugins/pepper_webplugin_impl.cc
@@ -59,8 +59,10 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) {
void WebPluginImpl::destroy() {
container_ = NULL;
- instance_->Delete();
- instance_ = NULL;
+ if (instance_) {
+ instance_->Delete();
+ instance_ = NULL;
+ }
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}