Setting dash to empty requires passing of an empty vector. In VisualStudio 2008 an exception is thrown due to dereference of first element of an empty vector, which is not allowed (in GCC it is allowed, and code below works correctly). This applies to debug and release builds with default SCL_SECURE configuration. void Context::set_dash(std::vector<double>& dashes, double offset) { cairo_set_dash(cobj(), &dashes[0], dashes.size(), offset); check_object_status_and_throw_exception(*this); } a proposed solution is to add specific check void Context::set_dash(std::vector<double>& dashes, double offset) { cairo_set_dash(cobj(), dashes.size()?&dashes[0]:NULL, dashes.size(), offset); check_object_status_and_throw_exception(*this); } The same is applicable for const version of the function. This fixes issue for me. Interesting discusion of this problem can be found at: http://stackoverflow.com/questions/3829788/using-operator-on-empty-stdvector
Sorry for the very late reply. You are quite right. We should be checking these vectors before derefencing them. I have done that in that method and a few others: http://cgit.freedesktop.org/cairomm/commit/?id=798a292d2ec0c05e6ccf9108c6a973651a3ddcfe The functions are not explicitly documented as accepting NULL for these parameters, but it seems like it should be OK, as long as the size is 0. Thanks.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.