Commit 531c4855 authored by Steve Lhomme's avatar Steve Lhomme

Thumbnailer: debug the early release of the thumbnailer_sys_t

parent e389341d
...@@ -117,13 +117,32 @@ static void *Lock(void *opaque, void **pixels) ...@@ -117,13 +117,32 @@ static void *Lock(void *opaque, void **pixels)
return nullptr; return nullptr;
} }
#ifndef NDEBUG
void OutputFormattedDebug(LPTSTR pMsg, ...) {
LPTSTR pBuffer = NULL;
va_list args = NULL;
va_start(args, pMsg);
FormatMessage(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER, pMsg, 0, 0, (LPTSTR)&pBuffer, 0, &args);
va_end(args);
if (pBuffer) {
OutputDebugString(pBuffer);
LocalFree(pBuffer);
}
}
#endif /* NDEBUG */
static WriteableBitmap^ CopyToBitmap(thumbnailer_sys_t* sys) static WriteableBitmap^ CopyToBitmap(thumbnailer_sys_t* sys)
{ {
#ifndef NDEBUG
OutputFormattedDebug(L"received bitmap thumb_sys 0x%1!p! %2!d!x%3!d!\n", sys, sys->thumbWidth, sys->thumbHeight);
#else /* !NDEBUG */
if (sys->thumbWidth > INT32_MAX || sys->thumbWidth > INT32_MAX) if (sys->thumbWidth > INT32_MAX || sys->thumbWidth > INT32_MAX)
{ {
assert(sys->thumbWidth < INT32_MAX && sys->thumbWidth < INT32_MAX); assert(sys->thumbWidth < INT32_MAX && sys->thumbWidth < INT32_MAX);
return nullptr; return nullptr;
} }
#endif /* !NDEBUG */
WriteableBitmap^ bmp = ref new WriteableBitmap(static_cast<int>(sys->thumbWidth), static_cast<int>(sys->thumbHeight)); WriteableBitmap^ bmp = ref new WriteableBitmap(static_cast<int>(sys->thumbWidth), static_cast<int>(sys->thumbHeight));
#if FAST_COPY #if FAST_COPY
...@@ -221,6 +240,9 @@ IAsyncOperation<PreparseResult^>^ Thumbnailer::TakeScreenshot(Platform::String^ ...@@ -221,6 +240,9 @@ IAsyncOperation<PreparseResult^>^ Thumbnailer::TakeScreenshot(Platform::String^
unsigned int pitch = width * PIXEL_SIZE; unsigned int pitch = width * PIXEL_SIZE;
sys->thumbHeight = height; sys->thumbHeight = height;
sys->thumbWidth = width; sys->thumbWidth = width;
#ifndef NDEBUG
OutputFormattedDebug(L"created thumb_sys 0x%1!p! %2!d!x%3!d!\n", sys, sys->thumbWidth, sys->thumbHeight);
#endif /* NDEBUG */
sys->thumbSize = pitch * sys->thumbHeight; sys->thumbSize = pitch * sys->thumbHeight;
sys->thumbData.reset(new char[sys->thumbSize]); sys->thumbData.reset(new char[sys->thumbSize]);
sys->hLock = CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE); sys->hLock = CreateEventEx(nullptr, nullptr, 0, EVENT_MODIFY_STATE);
...@@ -259,6 +281,9 @@ IAsyncOperation<PreparseResult^>^ Thumbnailer::TakeScreenshot(Platform::String^ ...@@ -259,6 +281,9 @@ IAsyncOperation<PreparseResult^>^ Thumbnailer::TakeScreenshot(Platform::String^
libvlc_media_player_release(mp); libvlc_media_player_release(mp);
CloseHandle(sys->hLock); CloseHandle(sys->hLock);
delete sys; delete sys;
#ifndef NDEBUG
OutputFormattedDebug(L"release thumb_sys 0x%1!p!\n", sys);
#endif /* NDEBUG */
}); });
return completionTask; return completionTask;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment