Bug 1278452 - Avoid a null deref in widget/. r=karlt.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 07 Jun 2016 16:03:34 +1000
changeset 301032 cf7ac0a043f9d45fc4c852e26d1d59e4d1ee7468
parent 301031 2202233b5b183143c85ab7a65b84a90003c262b3
child 301033 ae2bafad2ec2e5a2de35bce1b5e8939e8d26cff5
push id19599
push usercbook@mozilla.com
push dateWed, 08 Jun 2016 10:16:21 +0000
treeherderfx-team@81f4cc3f6f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1278452
milestone50.0a1
Bug 1278452 - Avoid a null deref in widget/. r=karlt.
widget/nsDragServiceProxy.cpp
--- a/widget/nsDragServiceProxy.cpp
+++ b/widget/nsDragServiceProxy.cpp
@@ -45,25 +45,25 @@ nsDragServiceProxy::InvokeDragSessionImp
     nsPresContext* pc;
     RefPtr<mozilla::gfx::SourceSurface> surface;
     DrawDrag(mSourceNode, aRegion, mScreenX, mScreenY,
              &dragRect, &surface, &pc);
 
     if (surface) {
       RefPtr<mozilla::gfx::DataSourceSurface> dataSurface =
         surface->GetDataSurface();
-      mozilla::gfx::IntSize size = dataSurface->GetSize();
       if (dataSurface) {
         size_t length;
         int32_t stride;
         mozilla::UniquePtr<char[]> surfaceData =
           nsContentUtils::GetSurfaceData(WrapNotNull(dataSurface), &length,
                                          &stride);
         nsDependentCString dragImage(surfaceData.get(), length);
 
+        mozilla::gfx::IntSize size = dataSurface->GetSize();
         mozilla::Unused <<
           child->SendInvokeDragSession(dataTransfers, aActionType, dragImage,
                                        size.width, size.height, stride,
                                        static_cast<uint8_t>(dataSurface->GetFormat()),
                                        dragRect.x, dragRect.y);
         StartDragSession();
         return NS_OK;
       }