Fix several problems with wxAppProgressIndicator in wxOSX

Don't release NSProgressIndicator too soon, we need to be able to keep
it to use it later, so move "release" from wxAppProgressDockIcon ctor to
its dtor.

OTOH, remove an extraneous "retain" to fix memory leak of
wxAppProgressDockIcon.

Finally, show the indicator, if it had been hidden, when Pulse() is
called for consistency with SetProgress().

Closes https://github.com/wxWidgets/wxWidgets/pull/1150
This commit is contained in:
Konstantin S. Matveyev
2019-01-19 18:06:08 +03:00
committed by Vadim Zeitlin
parent a0d2212bba
commit 557b8526d1

View File

@@ -42,15 +42,21 @@
[m_progIndicator setBezeled:YES];
[m_progIndicator setMinValue:0];
[m_progIndicator setMaxValue:1];
[m_progIndicator release];
[self setProgress:0.0];
}
return self;
}
- (void)dealloc
{
[m_progIndicator release];
[super dealloc];
}
- (void)setProgress: (double)value
{
[m_progIndicator setHidden:NO];
[m_progIndicator setIndeterminate:NO];
[m_progIndicator setDoubleValue:value];
[m_dockTile display];
@@ -58,6 +64,7 @@
- (void)setIndeterminate: (bool)indeterminate
{
[m_progIndicator setHidden:NO];
[m_progIndicator setIndeterminate:indeterminate];
[m_dockTile display];
@@ -75,7 +82,7 @@
wxAppProgressIndicator::wxAppProgressIndicator(wxWindow* WXUNUSED(parent), int maxValue ):
m_maxValue(maxValue)
{
wxAppProgressDockIcon* dockIcon = [[[wxAppProgressDockIcon alloc] init] retain];
wxAppProgressDockIcon* dockIcon = [[wxAppProgressDockIcon alloc] init];
m_dockIcon = dockIcon;
}