fixing possible null ptr access or memory leaks according to analyzer

This commit is contained in:
Stefan Csomor
2017-06-07 17:50:17 +02:00
parent 2f4b249fcf
commit 76305b53ad
4 changed files with 10 additions and 10 deletions

View File

@@ -314,7 +314,7 @@ void wxFileDialog::ShowWindowModal()
if (GetParent())
parentWindow = dynamic_cast<wxNonOwnedWindow*>(wxGetTopLevelParent(GetParent()));
wxASSERT_MSG(parentWindow, "Window modal display requires parent.");
wxCHECK_RET(parentWindow, "Window modal display requires parent.");
wxGCC_WARNING_SUPPRESS(deprecated-declarations)

View File

@@ -335,7 +335,7 @@ private:
if ( self = [super initWithFrame:rect] )
{
[self setWantsLayer:YES];
AVPlayerLayer* playerlayer = [[AVPlayerLayer playerLayerWithPlayer: player] retain];
AVPlayerLayer* playerlayer = [AVPlayerLayer playerLayerWithPlayer: player];
[player setPlayerLayer:playerlayer];
[playerlayer setFrame:[[self layer] bounds]];

View File

@@ -173,8 +173,6 @@ int wxMessageDialog::ShowModal()
void wxMessageDialog::ShowWindowModal()
{
NSAlert* alert = (NSAlert*)ConstructNSAlert();
wxNonOwnedWindow* parentWindow = NULL;
m_modality = wxDIALOG_MODALITY_WINDOW_MODAL;
@@ -186,6 +184,8 @@ void wxMessageDialog::ShowWindowModal()
if (parentWindow)
{
NSAlert* alert = (NSAlert*)ConstructNSAlert();
NSWindow* nativeParent = parentWindow->GetWXWindow();
[alert beginSheetModalForWindow: nativeParent modalDelegate: m_sheetDelegate
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)

View File

@@ -856,16 +856,16 @@ bool wxNSTextViewControl::GetStyle(long position, wxTextAttr& style)
if (position < (long) [[m_textView string] length])
{
NSTextStorage* storage = [m_textView textStorage];
font = [[storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL] autorelease];
bgcolor = [[storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:NULL] autorelease];
fgcolor = [[storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:NULL] autorelease];
font = [storage attribute:NSFontAttributeName atIndex:position effectiveRange:NULL];
bgcolor = [storage attribute:NSBackgroundColorAttributeName atIndex:position effectiveRange:NULL];
fgcolor = [storage attribute:NSForegroundColorAttributeName atIndex:position effectiveRange:NULL];
}
else
{
NSDictionary* attrs = [m_textView typingAttributes];
font = [[attrs objectForKey:NSFontAttributeName] autorelease];
bgcolor = [[attrs objectForKey:NSBackgroundColorAttributeName] autorelease];
fgcolor = [[attrs objectForKey:NSForegroundColorAttributeName] autorelease];
font = [attrs objectForKey:NSFontAttributeName];
bgcolor = [attrs objectForKey:NSBackgroundColorAttributeName];
fgcolor = [attrs objectForKey:NSForegroundColorAttributeName];
}
if (font)