- GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
- gdk_region_destroy( M_REGIONDATA->m_region );
- M_REGIONDATA->m_region = reg;
+ if (!m_refData)
+ {
+ m_refData = new wxRegionRefData();
+ GdkRegion *reg = gdk_region_new();
+ M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
+ gdk_region_destroy( reg );
+ }
+ else
+ {
+ GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
+ gdk_region_destroy( M_REGIONDATA->m_region );
+ M_REGIONDATA->m_region = reg;
+ }
+