[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - fpicker/source
Tor Lillqvist
tml at collabora.com
Tue Mar 4 02:38:53 PST 2014
fpicker/source/aqua/ControlHelper.mm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 02a67e46c99f90cbfda417b771f4dc3f29849e17
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Mar 4 11:58:34 2014 +0200
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
diff --git a/fpicker/source/aqua/ControlHelper.mm b/fpicker/source/aqua/ControlHelper.mm
index c627d9b..78a2a50 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__);
More information about the Libreoffice-commits
mailing list