summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-01-24 13:15:20 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2013-01-24 13:15:20 +0000
commit60a40dfaefa21fc5e3119cd54894109f03963f59 (patch)
tree0730a4cf8a15f0a2625643f413d23fd7d491d619 /libs
parentba602ea01ae1c392222decc6d1546620d249ecc1 (diff)
patch/fix for crash when pixfader is exposed after being allocated only 1xN or Nx1 pixels
git-svn-id: svn://localhost/ardour2/branches/3.0@13986 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/gtkmm2ext/pixfader.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc
index e3a6036bcb..005e9dcefd 100644
--- a/libs/gtkmm2ext/pixfader.cc
+++ b/libs/gtkmm2ext/pixfader.cc
@@ -188,13 +188,35 @@ PixFader::on_expose_event (GdkEventExpose* ev)
Cairo::RefPtr<Cairo::Context> context = get_window()->create_cairo_context();
cairo_t* cr = context->cobj();
- cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
- cairo_clip (cr);
-
if (!pattern) {
create_patterns();
}
+ if (!pattern) {
+
+ /* this isn't supposed to be happen, but some wackiness whereby
+ the pixfader ends up with a 1xN or Nx1 size allocation
+ leads to it. the basic wackiness needs fixing but we
+ shouldn't crash. just fill in the expose area with
+ our bg color.
+ */
+
+ Gdk::Color c = get_style()->get_bg (get_state());
+ float br, bg, bb;
+
+ br = c.get_red_p ();
+ bg = c.get_green_p ();
+ bb = c.get_blue_p ();
+ cairo_set_source_rgb (cr, br, bg, bb);
+ cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
+ cairo_fill (cr);
+
+ return true;
+ }
+
+ cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
+ cairo_clip (cr);
+
int ds = display_span ();
float w = get_width();
float h = get_height();