diff options
-rw-r--r-- | app/gfx/path.h | 1 | ||||
-rw-r--r-- | app/gfx/path_gtk.cc | 7 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 5 |
3 files changed, 12 insertions, 1 deletions
diff --git a/app/gfx/path.h b/app/gfx/path.h index 96ae427..8062e34 100644 --- a/app/gfx/path.h +++ b/app/gfx/path.h @@ -28,6 +28,7 @@ class Path : public SkPath { #elif defined(OS_LINUX) // Creates a Gdkregion from the path. The caller is responsible for freeing // resources used by this region. This only supports polygon paths. + // WARNING: this returns NULL for an empty Path. GdkRegion* CreateGdkRegion() const; #endif diff --git a/app/gfx/path_gtk.cc b/app/gfx/path_gtk.cc index bc35857..9a2b92c 100644 --- a/app/gfx/path_gtk.cc +++ b/app/gfx/path_gtk.cc @@ -7,11 +7,18 @@ #include <gdk/gdk.h> #include "base/scoped_ptr.h" +#include "base/command_line.h" namespace gfx { GdkRegion* Path::CreateGdkRegion() const { int point_count = getPoints(NULL, 0); + if (point_count <= 1) { + // NOTE: ideally this would return gdk_empty_region, but that returns a + // region with nothing in it. + return NULL; + } + scoped_array<SkPoint> points(new SkPoint[point_count]); getPoints(points.get(), point_count); diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index 11c2a77..1643e1b 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -315,7 +315,10 @@ void WindowGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { &window_mask); GdkRegion* mask_region = window_mask.CreateGdkRegion(); gdk_window_shape_combine_region(GetNativeView()->window, mask_region, 0, 0); - gdk_region_destroy(mask_region); + if (mask_region) + gdk_region_destroy(mask_region); + + SaveWindowPosition(); } gboolean WindowGtk::OnWindowStateEvent(GtkWidget* widget, |