aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2015-03-17 15:13:51 +1100
committerNeil Hodgson <nyamatongwe@gmail.com>2015-03-17 15:13:51 +1100
commit0981a025bad27ed9b829e19f9062197f232ba6cb (patch)
treedc01cfd5d6554a3994d3b6d26ab674a894a5e48f
parente0d6ca2994212e693887098d4877e6560654c87b (diff)
downloadscintilla-mirror-0981a025bad27ed9b829e19f9062197f232ba6cb.tar.gz
Bug [#1706]. Release list box objects when autocompletion closed.
-rw-r--r--cocoa/PlatCocoa.mm57
-rw-r--r--doc/ScintillaHistory.html4
2 files changed, 46 insertions, 15 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 7645fdd65..442f1f3bb 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1094,21 +1094,7 @@ Window::~Window()
{
}
-//--------------------------------------------------------------------------------------------------
-
-void Window::Destroy()
-{
- if (wid)
- {
- id idWin = reinterpret_cast<id>(wid);
- if ([idWin isKindOfClass: [NSWindow class]])
- {
- NSWindow* win = reinterpret_cast<NSWindow*>(idWin);
- [win release];
- }
- }
- wid = 0;
-}
+// Window::Destroy needs to see definition of ListBoxImpl so is located after ListBoxImpl
//--------------------------------------------------------------------------------------------------
@@ -1379,6 +1365,8 @@ static NSImage* ImageFromXPM(XPM* pxpm)
//----------------- ListBox and related classes ----------------------------------------------------
+//----------------- IListBox -----------------------------------------------------------------------
+
namespace {
// unnamed namespace hides IListBox interface
@@ -1572,6 +1560,9 @@ public:
}
void SetList(const char* list, char separator, char typesep);
+ // To clean up when closed
+ void ReleaseViews();
+
// For access from AutoCompletionDataSource implement IListBox
int Rows();
NSImage* ImageForRow(NSInteger row);
@@ -1690,6 +1681,20 @@ int ListBoxImpl::CaretFromEdge()
return 6 + static_cast<int>([colIcon width]);
}
+void ListBoxImpl::ReleaseViews()
+{
+ [table release];
+ table = nil;
+ [scroller release];
+ scroller = nil;
+ [colIcon release];
+ colIcon = nil;
+ [colText release ];
+ colText = nil;
+ [ds release];
+ ds = nil;
+}
+
void ListBoxImpl::Clear()
{
maxItemWidth = 0;
@@ -1905,6 +1910,28 @@ ListBox* ListBox::Allocate()
return lb;
}
+//--------------------------------------------------------------------------------------------------
+
+void Window::Destroy()
+{
+ ListBoxImpl *listbox = dynamic_cast<ListBoxImpl *>(this);
+ if (listbox)
+ {
+ listbox->ReleaseViews();
+ }
+ if (wid)
+ {
+ id idWin = reinterpret_cast<id>(wid);
+ if ([idWin isKindOfClass: [NSWindow class]])
+ {
+ NSWindow* win = reinterpret_cast<NSWindow*>(idWin);
+ [win release];
+ }
+ }
+ wid = 0;
+}
+
+
//----------------- ScintillaContextMenu -----------------------------------------------------------
@implementation ScintillaContextMenu : NSMenu
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 1d27d3d3d..03e453995 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -499,6 +499,10 @@
switching calltips and the new calltip required a taller window.
</li>
<li>
+ Fix leak on Cocoa with autocompletion lists.
+ <a href="http://sourceforge.net/p/scintilla/bugs/1706/">Bug #1706</a>.
+ </li>
+ <li>
Fix bug on Windows when compiling with MinGW-w64 which caused text to not be drawn
when in wrap mode.
<a href="http://sourceforge.net/p/scintilla/bugs/1705/">Bug #1705</a>.