summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-03-04 11:58:34 +0200
committerTor Lillqvist <tml@collabora.com>2014-03-04 12:41:27 +0200
commit9a06a6e6499e275c3b277cd88878522757a5de37 (patch)
tree90f8f0c85a6f0468c784a28215abf6c486787244 /fpicker
parentf3a79ea8c3a2949845a14f323b9399a74ef3f607 (diff)
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
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/aqua/ControlHelper.mm8
1 files changed, 4 insertions, 4 deletions
diff --git a/fpicker/source/aqua/ControlHelper.mm b/fpicker/source/aqua/ControlHelper.mm
index 025639ab18d9..08a3971a6cf9 100644
--- a/fpicker/source/aqua/ControlHelper.mm
+++ b/fpicker/source/aqua/ControlHelper.mm
@@ -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__);