Hi Sascha, thanks for your quick reply. Oh boy, very embarrassing. Problem solved.
I use RemoveNode() (as intended) instead of Delete() and now it works like a charm. Please don't ask we why I used the berry::Object::Delete() instead of IPreference::RemoveNode(). No wonder I provoked an access violation. Too little sleep lately, I guess. Thanks for pointing it out. Kind regards, Ralf -----Ursprüngliche Nachricht----- Von: Sascha Zelzer [mailto:[email protected]] Gesendet: Montag, 13. Januar 2014 15:04 An: Floca, Ralf Omar; [email protected] Betreff: Re: [mitk-users] What is the correct way to reset prefences Hi Ralf, On 01/10/2014 10:58 PM, Floca, Ralf Omar wrote: > ... > 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. Did you use IPreferences::RemoveNode() ? > > 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] Is this a typo? There is no IPreferences::Delete() method... Could you maybe post a short code snippet for the IPreferences code which triggers the call stack below? Thanks, Sascha > > 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 ------------------------------------------------------------------------------ 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
