tdf#127863: fix crash when trying to edit assigned macro to a button

see bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=154638

Let's avoid iterator use here to avoid invalid iterator in debug mode
+ slight formatting

Change-Id: I40b42201ad299aee33275b2c961e1e0233f86ad4
Reviewed-on: https://gerrit.libreoffice.org/79812
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Julien Nabet
2019-09-29 14:09:26 +02:00
committed by Noel Grandin
parent 66eedce71f
commit 725b51044b

View File

@@ -303,7 +303,7 @@ namespace pcr
{
private:
typedef std::unordered_map< OUString, ScriptEventDescriptor > EventMap;
typedef std::map< EventId, EventMap::iterator > EventMapIndexAccess;
typedef std::map< EventId, OUString > EventMapIndexAccess;
EventMap m_aEventNameAccess;
EventMapIndexAccess m_aEventIndexAccess;
@@ -349,7 +349,7 @@ namespace pcr
std::pair< EventMap::iterator, bool > insertionResult =
m_aEventNameAccess.emplace( _rEventName, _rScriptEvent );
OSL_ENSURE( insertionResult.second, "EventHolder::addEvent: there already was a MacroURL for this event!" );
m_aEventIndexAccess[ _nId ] = insertionResult.first;
m_aEventIndexAccess[ _nId ] = _rEventName;
}
ScriptEventDescriptor EventHolder::getNormalizedDescriptorByName( const OUString& _rEventName ) const
@@ -409,7 +409,7 @@ namespace pcr
// appear in the property browser UI.
for (auto const& elem : m_aEventIndexAccess)
{
*pReturn = elem.second->first;
*pReturn = elem.second;
++pReturn;
}
return aReturn;