Kaydet (Commit) 9a06a6e6 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Avoid potentially sending message to deallocated instance

The m_pFilterControl is always added to the m_aActiveControls list
(see createFilterControl()), so it has been released by the loop over
the list. So make sure to call setTarget before the loop.

For some reason this doesn't normally cause sending a message to a
deallocated instance, though. (I only noticed it when experimenting
with if-zeroing out the creation of the user pane.) I guess this might
mean that we actually have a leak here, if the controls in the list
don't actually get deallocated by the release messages in the loop?

Change-Id: If691f8d35bab606ce8a61f677d8e495e72a23148
üst f3a79ea8
......@@ -78,6 +78,10 @@ ControlHelper::~ControlHelper()
[m_pUserPane release];
}
if (m_pFilterControl != NULL) {
[m_pFilterControl setTarget:nil];
}
for(std::list<NSControl *>::iterator control = m_aActiveControls.begin(); control != m_aActiveControls.end(); ++control) {
NSControl* pControl = (*control);
NSString* sLabelName = m_aMapListLabels[pControl];
......@@ -93,10 +97,6 @@ ControlHelper::~ControlHelper()
[pControl release];
}
if (m_pFilterControl != NULL) {
[m_pFilterControl setTarget:nil];
}
[pool release];
DBG_PRINT_EXIT(CLASS_NAME, __func__);
......
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