Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkasper93 <kasper93@gmail.com>2014-09-07 00:22:58 +0400
committerkasper93 <kasper93@gmail.com>2014-09-20 00:19:24 +0400
commit2a0d0c2d49032cad240147db0cb1f252358bc7b6 (patch)
tree8f333bfe7af0560b4334349f4f287aa4c7908255 /src/Subtitles/RTS.cpp
parentab173b5cae503a03625ae65173e6adfbfa8bd17b (diff)
Properly catch a bad allocation exception.
On MFC projects `CMemoryException` is thrown instead of the STL's `std::bad_alloc` exception.
Diffstat (limited to 'src/Subtitles/RTS.cpp')
-rw-r--r--src/Subtitles/RTS.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Subtitles/RTS.cpp b/src/Subtitles/RTS.cpp
index 84ad1ba93..ec158b73d 100644
--- a/src/Subtitles/RTS.cpp
+++ b/src/Subtitles/RTS.cpp
@@ -788,7 +788,8 @@ CClipper::CClipper(CStringW str, const CSize& size, double scalex, double scaley
try {
m_pAlphaMask = DEBUG_NEW BYTE[alphaMaskSize];
- } catch (std::bad_alloc) {
+ } catch (CMemoryException* e) {
+ e->Delete();
return;
}
@@ -1207,7 +1208,8 @@ CLine* CSubtitle::GetNextLine(POSITION& pos, int maxwidth)
CLine* ret;
try {
ret = DEBUG_NEW CLine();
- } catch (std::bad_alloc) {
+ } catch (CMemoryException* e) {
+ e->Delete();
return nullptr;
}
@@ -1302,7 +1304,8 @@ void CSubtitle::CreateClippers(CSize size)
str.Format(L"m %d %d l %d %d %d %d %d %d", 0, 0, w, 0, w, h, 0, h);
try {
m_pClipper = DEBUG_NEW CClipper(str, size, 1, 1, false, CPoint(0, 0), m_renderingCaches);
- } catch (std::bad_alloc) {
+ } catch (CMemoryException* e) {
+ e->Delete();
return;
}
}
@@ -1341,7 +1344,8 @@ void CSubtitle::CreateClippers(CSize size)
try {
m_pClipper = DEBUG_NEW CClipper(str, size, 1, 1, false, CPoint(0, 0),
m_renderingCaches);
- } catch (std::bad_alloc) {
+ } catch (CMemoryException* e) {
+ e->Delete();
return;
}
}
@@ -1710,7 +1714,8 @@ void CRenderedTextSubtitle::ParseEffect(CSubtitle* sub, CString str)
Effect* e;
try {
e = DEBUG_NEW Effect;
- } catch (std::bad_alloc) {
+ } catch (CMemoryException* e) {
+ e->Delete();
return;
}
@@ -1737,7 +1742,8 @@ void CRenderedTextSubtitle::ParseEffect(CSubtitle* sub, CString str)
Effect* e;
try {
e = DEBUG_NEW Effect;
- } catch (std::bad_alloc) {
+ } catch (CMemoryException* e) {
+ e->Delete();
return;
}
@@ -2625,7 +2631,8 @@ CSubtitle* CRenderedTextSubtitle::GetSubtitle(int entry)
try {
sub = DEBUG_NEW CSubtitle(m_renderingCaches);
- } catch (std::bad_alloc) {
+ } catch (CMemoryException* e) {
+ e->Delete();
return nullptr;
}