Kaydet (Commit) 8912cf30 authored tarafından Jan Holesovsky's avatar Jan Holesovsky

fdo#40261: Fix crash in XML Form Document.

The data structure holding the UI elements in the browser listbox was a
terrible mess - it held the items in an unordered_map, but then accessed
them via a vector containing iterators to this unordered_map.

Fixed the problem (and cleaned all this up) by removing the vector of
iterators, and turning the unordered_map into a normal vector.  When we need
access by name, we just go through all the items; it is always just a handful
of them anyway.
üst 0787025c
...@@ -65,19 +65,19 @@ namespace pcr ...@@ -65,19 +65,19 @@ namespace pcr
typedef ::boost::shared_ptr< OBrowserLine > BrowserLinePointer; typedef ::boost::shared_ptr< OBrowserLine > BrowserLinePointer;
struct ListBoxLine struct ListBoxLine
{ {
::rtl::OUString aName;
BrowserLinePointer pLine; BrowserLinePointer pLine;
::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >
xHandler; xHandler;
ListBoxLine() { } ListBoxLine( const ::rtl::OUString& rName, BrowserLinePointer _pLine, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _rxHandler )
ListBoxLine( BrowserLinePointer _pLine, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _rxHandler ) : aName( rName ),
:pLine( _pLine ) pLine( _pLine ),
,xHandler( _rxHandler ) xHandler( _rxHandler )
{ {
} }
}; };
typedef ::boost::unordered_map< ::rtl::OUString, ListBoxLine, ::rtl::OUStringHash > ListBoxLines; typedef ::std::vector< ListBoxLine > ListBoxLines;
typedef ::std::vector< ListBoxLines::iterator > OrderedListBoxLines;
//======================================================================== //========================================================================
//= IControlContext //= IControlContext
...@@ -106,7 +106,6 @@ namespace pcr ...@@ -106,7 +106,6 @@ namespace pcr
::std::auto_ptr< InspectorHelpWindow > ::std::auto_ptr< InspectorHelpWindow >
m_pHelpWindow; m_pHelpWindow;
ListBoxLines m_aLines; ListBoxLines m_aLines;
OrderedListBoxLines m_aOrderedLines;
IPropertyLineListener* m_pLineListener; IPropertyLineListener* m_pLineListener;
IPropertyControlObserver* m_pControlObserver; IPropertyControlObserver* m_pControlObserver;
long m_nYOffset; long m_nYOffset;
...@@ -192,16 +191,6 @@ namespace pcr ...@@ -192,16 +191,6 @@ namespace pcr
*/ */
sal_uInt16 impl_getControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ) const; sal_uInt16 impl_getControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ) const;
/** retrieves (a reference to) the ->ListBoxLine for a given control
@param _rxControl
The control to lookup. Must denote a control of one of the lines in ->m_aLines
*/
inline const ListBoxLine&
impl_getControlLine( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ) const
{
return m_aOrderedLines[ impl_getControlPos( _rxControl ) ]->second;
}
/** sets the given property value at the given control, after converting it as necessary /** sets the given property value at the given control, after converting it as necessary
@param _rLine @param _rLine
The line whose at which the value is to be set. The line whose at which the value is to be set.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment