From: kiirala Date: Tue, 5 Feb 2008 07:15:06 +0000 (+0000) Subject: Patch by John Faith: fixed crash resulting from inproperly initialized std::map X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d5d05ac0115e3bf6f241f903598ca639fc4898cb;p=inkscape.git Patch by John Faith: fixed crash resulting from inproperly initialized std::map --- diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index c74a9ffdb..150033895 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -112,7 +112,8 @@ sp_filter_init(SPFilter *filter) filter->_renderer = NULL; - filter->_image_name = map(); + filter->_image_name = new std::map; + filter->_image_name->clear(); filter->filterRes = NumberOptNumber(); @@ -169,6 +170,7 @@ sp_filter_release(SPObject *object) } filter->modified_connection.~connection(); + delete filter->_image_name; if (((SPObjectClass *) filter_parent_class)->release) ((SPObjectClass *) filter_parent_class)->release(object); @@ -456,9 +458,9 @@ int sp_filter_primitive_count(SPFilter *filter) { int sp_filter_get_image_name(SPFilter *filter, gchar const *name) { gchar *name_copy = strdup(name); - map::iterator result = filter->_image_name.find(name_copy); + map::iterator result = filter->_image_name->find(name_copy); free(name_copy); - if (result == filter->_image_name.end()) return -1; + if (result == filter->_image_name->end()) return -1; else return (*result).second; } @@ -466,7 +468,8 @@ int sp_filter_set_image_name(SPFilter *filter, gchar const *name) { int value = filter->_image_number_next; filter->_image_number_next++; gchar *name_copy = strdup(name); - pair::iterator,bool> ret = filter->_image_name.insert(pair(name_copy, value)); + pair new_pair(name_copy, value); + pair::iterator,bool> ret = filter->_image_name->insert(new_pair); if (ret.second == false) { return (*ret.first).second; } diff --git a/src/sp-filter.h b/src/sp-filter.h index 9c4e7aaf6..3e9bb3cb0 100644 --- a/src/sp-filter.h +++ b/src/sp-filter.h @@ -60,7 +60,7 @@ struct SPFilter : public SPObject { NR::Filter *_renderer; - std::map _image_name; + std::map* _image_name; int _image_number_next; };