Fixed bug: Settings property attribute to wxNullVariant would cause GetAttribute() to fail (wxPG SourceForge bug #2128485)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1144,6 +1144,9 @@ public:
|
|||||||
|
|
||||||
@param value
|
@param value
|
||||||
Value of attribute.
|
Value of attribute.
|
||||||
|
|
||||||
|
@remarks Setting attribute's value to Null variant will simply remove it
|
||||||
|
from property's set of attributes.
|
||||||
*/
|
*/
|
||||||
void SetAttribute( const wxString& name, wxVariant value );
|
void SetAttribute( const wxString& name, wxVariant value );
|
||||||
|
|
||||||
|
@@ -659,6 +659,9 @@ public:
|
|||||||
Value of attribute.
|
Value of attribute.
|
||||||
@param argFlags
|
@param argFlags
|
||||||
Optional. Use wxPG_RECURSE to set the attribute to child properties recursively.
|
Optional. Use wxPG_RECURSE to set the attribute to child properties recursively.
|
||||||
|
|
||||||
|
@remarks Setting attribute's value to Null variant will simply remove it
|
||||||
|
from property's set of attributes.
|
||||||
*/
|
*/
|
||||||
void SetPropertyAttribute( wxPGPropArg id, const wxString& attrName, wxVariant value, long argFlags = 0 )
|
void SetPropertyAttribute( wxPGPropArg id, const wxString& attrName, wxVariant value, long argFlags = 0 )
|
||||||
{
|
{
|
||||||
|
@@ -946,6 +946,21 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
RT_START_TEST(Attributes)
|
||||||
|
|
||||||
|
wxPGProperty* prop = pgman->GetProperty(wxT("StringProperty"));
|
||||||
|
prop->SetAttribute(wxT("Dummy Attribute"), (long)15);
|
||||||
|
|
||||||
|
if ( prop->GetAttribute(wxT("Dummy Attribute")).GetLong() != 15 )
|
||||||
|
RT_FAILURE();
|
||||||
|
|
||||||
|
prop->SetAttribute(wxT("Dummy Attribute"), wxVariant());
|
||||||
|
|
||||||
|
if ( !prop->GetAttribute(wxT("Dummy Attribute")).IsNull() )
|
||||||
|
RT_FAILURE();
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
wxPropertyGridPage* page1;
|
wxPropertyGridPage* page1;
|
||||||
wxPropertyGridPage* page2;
|
wxPropertyGridPage* page2;
|
||||||
|
@@ -2093,12 +2093,23 @@ void wxPGAttributeStorage::Set( const wxString& name, const wxVariant& value )
|
|||||||
// Free old, if any
|
// Free old, if any
|
||||||
wxPGHashMapS2P::iterator it = m_map.find(name);
|
wxPGHashMapS2P::iterator it = m_map.find(name);
|
||||||
if ( it != m_map.end() )
|
if ( it != m_map.end() )
|
||||||
|
{
|
||||||
((wxVariantData*)it->second)->DecRef();
|
((wxVariantData*)it->second)->DecRef();
|
||||||
|
|
||||||
|
if ( !data )
|
||||||
|
{
|
||||||
|
// If Null variant, just remove from set
|
||||||
|
m_map.erase(it);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( data )
|
if ( data )
|
||||||
|
{
|
||||||
data->IncRef();
|
data->IncRef();
|
||||||
|
|
||||||
m_map[name] = data;
|
m_map[name] = data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_PROPGRID
|
#endif // wxUSE_PROPGRID
|
||||||
|
Reference in New Issue
Block a user