Hello everyone,
I have a question/problem concerning the usage of berry::IPreferences.
I use the the berry::IPreferencesService and IPreferences to store an array of
items (each item has set of values) in an preference node tree:
root/array/item1
root/array/item2
root/array/item3
The data is defined/altered in a class derived from berry::IQtPreferencePage.
In berry::IQtPreferencePage::PerformOK() the preference root node will be
actualized according to the data structure.
The easiest way to do this would be to reset "array" (removing all descant
nodes) and then fill "array" with the current items.
This approach seems not possible because berry::IPreferences::Clear() removes
only the value pairs and I cannot find another fitting method in the interface.
The second approach was
- remove "array" (array->Delete())
- flush "root" to persist the removal of "array"
- add "array" again (root->Node("array"))
- fill "array" with item nodes
- flush again
When I do so an press "ok" in the preference page I got an unhandled exception
(access violation).
[call stack see below]
It fails because the children of "root" are currently in an invalid state.
Now my questions?
1) Is it a bug or unsupported (mis)usage of preferences (then it should be
documented to avoid deleting and adding the same node path in one run)?
2) If it is not the right way to do it? The last option that came into my mind
is to iterate through the items and delete them "by hand" if the do not exist
any more.
A comment on that topic would be very nice. Thanks.
Kind regards,
Ralf
The call stack is:
> liborg_blueberry_core_runtime.dll!berry::SmartPointer<berry::Preferences>::Register()
> Zeile 306 + 0x14 Bytes C++
liborg_blueberry_core_runtime.dll!berry::SmartPointer<berry::Preferences>::SmartPointer<berry::Preferences>(const
berry::SmartPointer<berry::Preferences> & p) Zeile 86 C++
liborg_blueberry_core_runtime.dll!std::_Construct<berry::SmartPointer<berry::Preferences>,berry::SmartPointer<berry::Preferences>
const & __ptr64>(berry::SmartPointer<berry::Preferences> * _Ptr, const
berry::SmartPointer<berry::Preferences> & _Val) Zeile 48 + 0x33 Bytes C++
liborg_blueberry_core_runtime.dll!std::allocator<berry::SmartPointer<berry::Preferences>
>::construct(berry::SmartPointer<berry::Preferences> * _Ptr, const
berry::SmartPointer<berry::Preferences> & _Val) Zeile 198 C++
liborg_blueberry_core_runtime.dll!std::_Cons_val<std::allocator<berry::SmartPointer<berry::Preferences>
>,berry::SmartPointer<berry::Preferences>,berry::SmartPointer<berry::Preferences>
const & __ptr64>(std::allocator<berry::SmartPointer<berry::Preferences> > &
_Alval, berry::SmartPointer<berry::Preferences> * _Pdest, const
berry::SmartPointer<berry::Preferences> & _Src) Zeile 281 C++
liborg_blueberry_core_runtime.dll!std::_Uninit_copy<std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > >,berry::SmartPointer<berry::Preferences> *
__ptr64,std::allocator<berry::SmartPointer<berry::Preferences> >
>(std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > > * _First,
std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > > * _Last, berry::SmartPointer<berry::Preferences> * _Dest,
std::allocator<berry::SmartPointer<berry::Preferences> > & _Al,
std::_Nonscalar_ptr_iterator_tag __formal) Zeile 376 + 0x32 Bytes C++
liborg_blueberry_core_runtime.dll!std::_Uninitialized_copy<std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > >,berry::SmartPointer<berry::Preferences> *
__ptr64,std::allocator<berry::SmartPointer<berry::Preferences> >
>(std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > > * _First,
std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > > * _Last, berry::SmartPointer<berry::Preferences> * _Dest,
std::allocator<berry::SmartPointer<berry::Preferences> > & _Al) Zeile 414 +
0x9f Bytes C++
liborg_blueberry_core_runtime.dll!std::vector<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
>
>::_Ucopy<std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > >
>(std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > > * _First,
std::_Vector_const_iterator<std::_Vector_val<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > > * _Last, berry::SmartPointer<berry::Preferences> * _Ptr) Zeile 1318 +
0x88 Bytes C++
liborg_blueberry_core_runtime.dll!std::vector<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
>
>::vector<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> >(const
std::vector<berry::SmartPointer<berry::Preferences>,std::allocator<berry::SmartPointer<berry::Preferences>
> > & _Right) Zeile 539 + 0x7b Bytes C++
liborg_blueberry_core_runtime.dll!berry::Preferences::GetChildren() Zeile
103 + 0x18 Bytes C++
liborg_blueberry_core_runtime.dll!berry::XMLPreferencesStorage::ToDOMTree(berry::Preferences
* prefNode, Poco::XML::Node * parentDOMNode) Zeile 180 + 0x15 Bytes C++
liborg_blueberry_core_runtime.dll!berry::XMLPreferencesStorage::ToDOMTree(berry::Preferences
* prefNode, Poco::XML::Node * parentDOMNode) Zeile 184 + 0x2a Bytes C++
liborg_blueberry_core_runtime.dll!berry::XMLPreferencesStorage::ToDOMTree(berry::Preferences
* prefNode, Poco::XML::Node * parentDOMNode) Zeile 184 + 0x2a Bytes C++
liborg_blueberry_core_runtime.dll!berry::XMLPreferencesStorage::ToDOMTree(berry::Preferences
* prefNode, Poco::XML::Node * parentDOMNode) Zeile 184 + 0x2a Bytes C++
liborg_blueberry_core_runtime.dll!berry::XMLPreferencesStorage::Flush(berry::IPreferences
* __formal) Zeile 95 C++
liborg_blueberry_core_runtime.dll!berry::Preferences::Flush() Zeile 146 C++
liborg_mitk_gui_qt_application.dll!QmitkPreferencesDialog::SavePreferences()
Zeile 299 + 0x76 Bytes C++
liborg_mitk_gui_qt_application.dll!QmitkPreferencesDialog::OnDialogAccepted()
Zeile 306 C++
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users