aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/PlatCocoa.mm57
1 files changed, 42 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