RE: [litwindow-users] Re: m_current as a pointer
Status: Alpha
Brought to you by:
hajokirchhoff
|
From: yrs90 <yr...@ya...> - 2005-04-28 12:41:50
|
Oh, I didn't explain the failure mode for the m_current as pointer
implementation. I have to paraphrase this because I don't have the stack
trace at hand. When there was a rule defined using Current and data changed
(I presume this involved something like NotifyChanged("m_List");) then I
would see function calls related to find_scope that were sometimes seeking
...Current... and sometimes seeking the underlying data m_List. Anyway I
stepped through watching iterations of find_scope until I got a heap
failure.
I rationalized this by thinking that recursing m_current and getting an
m_List member must have triggered Current to be evaluated and so on.
However, I didn't stay with it long to pinpoint the propagation mechanism.
(Lots of loops...) Instead I did a combination of tracing and sitting on
breakpoints until I confirmed I had localized the failure.
Regards,
Joel
-----Original Message-----
Sent: Thursday, April 28, 2005 4:46 AM
To: lit...@li...
Subject: RE: [litwindow-users] Re: m_current as a pointer
> Can you post the relevant code? m_current declaration, and where you
> call NotifyChanged and other relevant places.
Let's see. This is a little hard to boil down. I presume (perhaps wrongly)
that you prefer the narrative explanation over a diff.
lwListAdapterBase header was changed so
mutable accessor m_current;
became
mutable accessor *m_current;
mutable accessor m_empty;
m_current was initialized to &m_empty in lwListAdapterBase constructor.
m_empty.destroy() is called in the lwListAdapterBase destructor.
The biggest changes were to CalcCurrent where empty is assigned an empty
object if not !is_valid and m_current either points to the the_item or
m_empty accessor depending on whether the container index indicated an item
was selected.
void lwListAdapterBase::CalcCurrent(int containerIndex) const {
if (m_items.is_valid() && m_items.is_container()) {
// the const_accessor points to the end item which is invalid
// but the type of the item is valid.
container c=m_items.get_container();
container::iterator i=containerIndex>=0 ?
m_items.get_container().at(containerIndex) : m_items.get_container().end();
accessor the_item=*i;
prop_t type=the_item.get_type();
if (!m_empty.is_valid())
m_empty=create_object(type);
if (i!=c.end())
m_current = &the_item;
else {
m_current = &m_empty;
}
g_rapidUI->ValueChanged(*m_current, true);
}
}
Commands to destroy m_current were removed. All ValueChanged() calls in
wxListObject were changed to reference *m_current rather than m_current.
---
[This E-mail scanned for viruses by Declude Virus]
|