Lots of release bugs fixed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: display.cpp
|
// Name: display.cpp
|
||||||
// Purpose: Mac implementation of wxDisplay class
|
// Purpose: Mac implementation of wxDisplay class
|
||||||
// Author: Brian Victor
|
// Author: Ryan Norton & Brian Victor
|
||||||
// Modified by: Royce Mitchell III & Ryan Norton
|
// Modified by: Royce Mitchell III
|
||||||
// Created: 06/21/02
|
// Created: 06/21/02
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) wxWidgets team
|
// Copyright: (c) wxWidgets team
|
||||||
@@ -244,10 +244,14 @@ wxArrayVideoModes
|
|||||||
DMListType pModes;
|
DMListType pModes;
|
||||||
DMDisplayModeListIteratorUPP uppMLI;
|
DMDisplayModeListIteratorUPP uppMLI;
|
||||||
DisplayIDType nDisplayID;
|
DisplayIDType nDisplayID;
|
||||||
|
OSErr err;
|
||||||
|
|
||||||
wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr);
|
err = DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false);
|
||||||
|
wxASSERT(err == noErr);
|
||||||
|
|
||||||
//Create a new list...
|
//Create a new list...
|
||||||
wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr, wxT("Could not create a new display mode list") );
|
err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes);
|
||||||
|
wxASSERT_MSG(err == noErr, wxT("Could not create a new display mode list") );
|
||||||
|
|
||||||
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeListIteratorProc);
|
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeListIteratorProc);
|
||||||
wxASSERT(uppMLI);
|
wxASSERT(uppMLI);
|
||||||
@@ -257,11 +261,13 @@ wxArrayVideoModes
|
|||||||
sModeInfo.pMatchMode = &mode;
|
sModeInfo.pMatchMode = &mode;
|
||||||
for (DMListIndexType i = 0; i < nNumModes; ++i)
|
for (DMListIndexType i = 0; i < nNumModes; ++i)
|
||||||
{
|
{
|
||||||
wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
|
err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
|
||||||
uppMLI, &sModeInfo) == noErr);
|
wxASSERT(err == noErr);
|
||||||
}
|
}
|
||||||
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
||||||
wxASSERT(DMDisposeList(pModes) == noErr);
|
|
||||||
|
err = DMDisposeList(pModes);
|
||||||
|
wxASSERT(err == noErr);
|
||||||
}
|
}
|
||||||
else //DM 1.0, 1.2, 1.x
|
else //DM 1.0, 1.2, 1.x
|
||||||
{
|
{
|
||||||
@@ -290,11 +296,14 @@ wxVideoMode wxDisplay::GetCurrentMode() const
|
|||||||
DMListType pModes;
|
DMListType pModes;
|
||||||
DMDisplayModeListIteratorUPP uppMLI;
|
DMDisplayModeListIteratorUPP uppMLI;
|
||||||
DisplayIDType nDisplayID;
|
DisplayIDType nDisplayID;
|
||||||
|
OSErr err;
|
||||||
|
|
||||||
wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr);
|
err = DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false);
|
||||||
|
wxASSERT(err == noErr);
|
||||||
|
|
||||||
//Create a new list...
|
//Create a new list...
|
||||||
wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr,
|
err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes);
|
||||||
wxT("Could not create a new display mode list") );
|
wxASSERT_MSG(err == noErr, wxT("Could not create a new display mode list") );
|
||||||
|
|
||||||
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeTransProc);
|
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeTransProc);
|
||||||
wxASSERT(uppMLI);
|
wxASSERT(uppMLI);
|
||||||
@@ -304,8 +313,8 @@ wxVideoMode wxDisplay::GetCurrentMode() const
|
|||||||
sModeInfo.psMode = &sMode;
|
sModeInfo.psMode = &sMode;
|
||||||
for (DMListIndexType i = 0; i < nNumModes; ++i)
|
for (DMListIndexType i = 0; i < nNumModes; ++i)
|
||||||
{
|
{
|
||||||
wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
|
err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
|
||||||
uppMLI, &sModeInfo) == noErr);
|
wxASSERT(err == noErr);
|
||||||
|
|
||||||
if ( sModeInfo.bMatched == true )
|
if ( sModeInfo.bMatched == true )
|
||||||
{
|
{
|
||||||
@@ -315,7 +324,9 @@ wxVideoMode wxDisplay::GetCurrentMode() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
||||||
wxASSERT(DMDisposeList(pModes) == noErr);
|
|
||||||
|
err = DMDisposeList(pModes);
|
||||||
|
wxASSERT(err == noErr);
|
||||||
}
|
}
|
||||||
else //Can't get current mode?
|
else //Can't get current mode?
|
||||||
{
|
{
|
||||||
@@ -368,11 +379,14 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
|
|||||||
DMListType pModes;
|
DMListType pModes;
|
||||||
DMDisplayModeListIteratorUPP uppMLI;
|
DMDisplayModeListIteratorUPP uppMLI;
|
||||||
DisplayIDType nDisplayID;
|
DisplayIDType nDisplayID;
|
||||||
|
OSErr err;
|
||||||
|
|
||||||
wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr);
|
err = DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false);
|
||||||
|
wxASSERT(err == noErr);
|
||||||
|
|
||||||
//Create a new list...
|
//Create a new list...
|
||||||
wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr,
|
err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes);
|
||||||
wxT("Could not create a new display mode list") );
|
wxASSERT_MSG(err == noErr, wxT("Could not create a new display mode list") );
|
||||||
|
|
||||||
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeInfoProc);
|
uppMLI = NewDMDisplayModeListIteratorUPP(DMModeInfoProc);
|
||||||
wxASSERT(uppMLI);
|
wxASSERT(uppMLI);
|
||||||
@@ -383,8 +397,9 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
for(i = 0; i < nNumModes; ++i)
|
for(i = 0; i < nNumModes; ++i)
|
||||||
{
|
{
|
||||||
wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
|
err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
|
||||||
uppMLI, &sModeInfo) == noErr);
|
wxASSERT(err == noErr);
|
||||||
|
|
||||||
if (sModeInfo.bMatched == true)
|
if (sModeInfo.bMatched == true)
|
||||||
{
|
{
|
||||||
sMode = sModeInfo.sMode;
|
sMode = sModeInfo.sMode;
|
||||||
@@ -395,7 +410,9 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
DisposeDMDisplayModeListIteratorUPP(uppMLI);
|
||||||
wxASSERT(DMDisposeList(pModes) == noErr);
|
|
||||||
|
err = DMDisposeList(pModes);
|
||||||
|
wxASSERT(err == noErr);
|
||||||
|
|
||||||
// For the really paranoid -
|
// For the really paranoid -
|
||||||
// unsigned long flags;
|
// unsigned long flags;
|
||||||
|
Reference in New Issue
Block a user