Added support for VLD and fixed a few memory leaks found by VLD.
This commit is contained in:
parent
12e37c30a2
commit
1cb2b2b4c8
7
etc/vld/bin/Win32/Microsoft.DTfW.DHL.manifest
Normal file
7
etc/vld/bin/Win32/Microsoft.DTfW.DHL.manifest
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<!-- $Id -->
|
||||||
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||||
|
<noInheritable />
|
||||||
|
<assemblyIdentity type="win32" name="Microsoft.DTfW.DHL" version="6.11.1.404" processorArchitecture="x86" />
|
||||||
|
<file name="dbghelp.dll" />
|
||||||
|
</assembly>
|
BIN
etc/vld/bin/Win32/dbghelp.dll
Normal file
BIN
etc/vld/bin/Win32/dbghelp.dll
Normal file
Binary file not shown.
BIN
etc/vld/bin/Win32/vld_x86.dll
Normal file
BIN
etc/vld/bin/Win32/vld_x86.dll
Normal file
Binary file not shown.
307
etc/vld/include/vld.h
Normal file
307
etc/vld/include/vld.h
Normal file
@ -0,0 +1,307 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Visual Leak Detector - Import Library Header
|
||||||
|
// Copyright (c) 2005-2012 VLD Team
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
//
|
||||||
|
// See COPYING.txt for the full terms of the GNU Lesser General Public License.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "vld_def.h"
|
||||||
|
|
||||||
|
#if defined _DEBUG || defined VLD_FORCE_ENABLE
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "vld.lib")
|
||||||
|
|
||||||
|
// Force a symbolic reference to the global VisualLeakDetector class object from
|
||||||
|
// the DLL. This ensures that the DLL is loaded and linked with the program,
|
||||||
|
// even if no code otherwise imports any of the DLL's exports.
|
||||||
|
#pragma comment(linker, "/include:__imp_?g_vld@@3VVisualLeakDetector@@A")
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Visual Leak Detector APIs
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
// VLDDisable - Disables Visual Leak Detector's memory leak detection at
|
||||||
|
// runtime. If memory leak detection is already disabled, then calling this
|
||||||
|
// function has no effect.
|
||||||
|
//
|
||||||
|
// Note: In multithreaded programs, this function operates on a per-thread
|
||||||
|
// basis. In other words, if you call this function from one thread, then
|
||||||
|
// memory leak detection is only disabled for that thread. If memory leak
|
||||||
|
// detection is enabled for other threads, then it will remain enabled for
|
||||||
|
// those other threads. It was designed to work this way to insulate you,
|
||||||
|
// the programmer, from having to ensure thread synchronization when calling
|
||||||
|
// VLDEnable() and VLDDisable(). Without this, calling these two functions
|
||||||
|
// unsynchronized could result in unpredictable and unintended behavior.
|
||||||
|
// But this also means that if you want to disable memory leak detection
|
||||||
|
// process-wide, then you need to call this function from every thread in
|
||||||
|
// the process.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDDisable ();
|
||||||
|
|
||||||
|
// VLDEnable - Enables Visual Leak Detector's memory leak detection at runtime.
|
||||||
|
// If memory leak detection is already enabled, which it is by default, then
|
||||||
|
// calling this function has no effect.
|
||||||
|
//
|
||||||
|
// Note: In multithreaded programs, this function operates on a per-thread
|
||||||
|
// basis. In other words, if you call this function from one thread, then
|
||||||
|
// memory leak detection is only enabled for that thread. If memory leak
|
||||||
|
// detection is disabled for other threads, then it will remain disabled for
|
||||||
|
// those other threads. It was designed to work this way to insulate you,
|
||||||
|
// the programmer, from having to ensure thread synchronization when calling
|
||||||
|
// VLDEnable() and VLDDisable(). Without this, calling these two functions
|
||||||
|
// unsynchronized could result in unpredictable and unintended behavior.
|
||||||
|
// But this also means that if you want to enable memory leak detection
|
||||||
|
// process-wide, then you need to call this function from every thread in
|
||||||
|
// the process.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDEnable ();
|
||||||
|
|
||||||
|
// VLDRestore - Restore Visual Leak Detector's previous state.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDRestore ();
|
||||||
|
|
||||||
|
// VLDGlobalDisable - Disables Visual Leak Detector's memory leak detection at
|
||||||
|
// runtime in all threads. If memory leak detection is already disabled,
|
||||||
|
// then calling this function has no effect.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDGlobalDisable ();
|
||||||
|
|
||||||
|
// VLDGlobalEnable - Enables Visual Leak Detector's memory leak detection
|
||||||
|
// at runtime in all threads. If memory leak detection is already enabled,
|
||||||
|
// which it is by default, then calling this function has no effect.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDGlobalEnable ();
|
||||||
|
|
||||||
|
// VLDReportLeaks - Report leaks up to the execution point.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) UINT VLDReportLeaks ();
|
||||||
|
|
||||||
|
// VLDGetLeaksCount - Return memory leaks count to the execution point.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) UINT VLDGetLeaksCount ();
|
||||||
|
|
||||||
|
// VLDMarkAllLeaksAsReported - Mark all leaks as reported.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDMarkAllLeaksAsReported ();
|
||||||
|
|
||||||
|
|
||||||
|
// VLDRefreshModules - Look for recently loaded DLLs and patch them if necessary.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDRefreshModules();
|
||||||
|
|
||||||
|
|
||||||
|
// VLDEnableModule - Enable Memory leak checking on the specified module.
|
||||||
|
//
|
||||||
|
// module: module handle.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
|
||||||
|
__declspec(dllimport) void VLDEnableModule(HMODULE module);
|
||||||
|
|
||||||
|
|
||||||
|
// VLDDisableModule - Disable Memory leak checking on the specified module.
|
||||||
|
//
|
||||||
|
// module: module handle.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDDisableModule(HMODULE module);
|
||||||
|
|
||||||
|
// VLDGetOptions - Return all current options.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// Mask of current options.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) UINT VLDGetOptions();
|
||||||
|
|
||||||
|
// VLDGetReportFilename - Return current report filename.
|
||||||
|
//
|
||||||
|
// filename: current report filename (max characters - MAX_PATH).
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDGetReportFilename(WCHAR *filename);
|
||||||
|
|
||||||
|
// VLDSetOptions - Update the report options via function call rather than INI file.
|
||||||
|
//
|
||||||
|
// option_mask: Only the following flags are checked
|
||||||
|
// VLD_OPT_AGGREGATE_DUPLICATES
|
||||||
|
// VLD_OPT_MODULE_LIST_INCLUDE
|
||||||
|
// VLD_OPT_SAFE_STACK_WALK
|
||||||
|
// VLD_OPT_SLOW_DEBUGGER_DUMP
|
||||||
|
// VLD_OPT_TRACE_INTERNAL_FRAMES
|
||||||
|
// VLD_OPT_START_DISABLED
|
||||||
|
// VLD_OPT_SKIP_HEAPFREE_LEAKS
|
||||||
|
// VLD_OPT_VALIDATE_HEAPFREE
|
||||||
|
//
|
||||||
|
// maxDataDump: maximum number of user-data bytes to dump for each leaked block.
|
||||||
|
//
|
||||||
|
// maxTraceFrames: maximum number of frames per stack trace for each leaked block.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDSetOptions(UINT option_mask, SIZE_T maxDataDump, UINT maxTraceFrames);
|
||||||
|
|
||||||
|
// VLDSetModulesList - Set list of modules included/excluded in leak detection
|
||||||
|
// depending on parameter "includeModules".
|
||||||
|
//
|
||||||
|
// modules: list of modules to be forcefully included/excluded in leak detection.
|
||||||
|
//
|
||||||
|
// includeModules: include or exclude that modules.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDSetModulesList(CONST WCHAR *modules, BOOL includeModules);
|
||||||
|
|
||||||
|
// VLDGetModulesList - Return current list of included/excluded modules
|
||||||
|
// depending on flag VLD_OPT_TRACE_INTERNAL_FRAMES.
|
||||||
|
//
|
||||||
|
// modules: destination string for list of included/excluded modules (maximum length 512 characters).
|
||||||
|
//
|
||||||
|
// size: maximum string size.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// BOOL: TRUE if include modules, otherwise FALSE.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) BOOL VLDGetModulesList(WCHAR *modules, UINT size);
|
||||||
|
|
||||||
|
// VLDSetReportOptions - Update the report options via function call rather than INI file.
|
||||||
|
//
|
||||||
|
// Only the following flags are checked
|
||||||
|
// VLD_OPT_REPORT_TO_DEBUGGER
|
||||||
|
// VLD_OPT_REPORT_TO_FILE
|
||||||
|
// VLD_OPT_REPORT_TO_STDOUT
|
||||||
|
// VLD_OPT_UNICODE_REPORT
|
||||||
|
//
|
||||||
|
// filename is optional and can be NULL.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) void VLDSetReportOptions(UINT option_mask, CONST WCHAR *filename);
|
||||||
|
|
||||||
|
// VLDSetReportHook - Installs or uninstalls a client-defined reporting function by hooking it
|
||||||
|
// into the C run-time debug reporting process (debug version only).
|
||||||
|
//
|
||||||
|
// mode: The action to take: VLD_RPTHOOK_INSTALL or VLD_RPTHOOK_REMOVE.
|
||||||
|
//
|
||||||
|
// pfnNewHook: Report hook to install or remove.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// int: 0 if success.
|
||||||
|
//
|
||||||
|
__declspec(dllimport) int VLDSetReportHook(int mode, VLD_REPORT_HOOK pfnNewHook);
|
||||||
|
|
||||||
|
// VLDResolveCallstacks - Performs symbol resolution for all saved extent CallStack's that have
|
||||||
|
// been tracked by Visual Leak Detector. This function is necessary for applications that
|
||||||
|
// dynamically load and unload modules, and through which memory leaks might be included.
|
||||||
|
// If this is NOT called, stack traces may have stack frames with no symbol information. This
|
||||||
|
// happens because the symbol API's cannot look up symbols for a binary / module that has been unloaded
|
||||||
|
// from the process.
|
||||||
|
//
|
||||||
|
// Return Value:
|
||||||
|
//
|
||||||
|
// None.
|
||||||
|
//
|
||||||
|
__declspec(dllexport) void VLDResolveCallstacks();
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif // __cplusplus
|
||||||
|
|
||||||
|
#else // !_DEBUG
|
||||||
|
|
||||||
|
#define VLDEnable()
|
||||||
|
#define VLDDisable()
|
||||||
|
#define VLDRestore()
|
||||||
|
#define VLDReportLeaks() 0
|
||||||
|
#define VLDGetLeaksCount() 0
|
||||||
|
#define VLDMarkAllLeaksAsReported()
|
||||||
|
#define VLDRefreshModules()
|
||||||
|
#define VLDEnableModule(a)
|
||||||
|
#define VLDDisableModule(b)
|
||||||
|
#define VLDGetOptions() 0
|
||||||
|
#define VLDGetReportFilename(a)
|
||||||
|
#define VLDSetOptions(a, b, c)
|
||||||
|
#define VLDSetReportHook(a, b)
|
||||||
|
#define VLDSetModulesList(a)
|
||||||
|
#define VLDGetModulesList(a, b) FALSE
|
||||||
|
#define VLDSetReportOptions(a, b)
|
||||||
|
|
||||||
|
#endif // _DEBUG
|
45
etc/vld/include/vld_def.h
Normal file
45
etc/vld/include/vld_def.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Visual Leak Detector - Import Library Header
|
||||||
|
// Copyright (c) 2005-2012 VLD Team
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
//
|
||||||
|
// See COPYING.txt for the full terms of the GNU Lesser General Public License.
|
||||||
|
//
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define VLD_OPT_AGGREGATE_DUPLICATES 0x0001 // If set, aggregate duplicate leaks in the leak report.
|
||||||
|
#define VLD_OPT_MODULE_LIST_INCLUDE 0x0002 // If set, modules in the module list are included, all others are excluded.
|
||||||
|
#define VLD_OPT_REPORT_TO_DEBUGGER 0x0004 // If set, the memory leak report is sent to the debugger.
|
||||||
|
#define VLD_OPT_REPORT_TO_FILE 0x0008 // If set, the memory leak report is sent to a file.
|
||||||
|
#define VLD_OPT_SAFE_STACK_WALK 0x0010 // If set, the stack is walked using the "safe" method (StackWalk64).
|
||||||
|
#define VLD_OPT_SELF_TEST 0x0020 // If set, perform a self-test to verify memory leak self-checking.
|
||||||
|
#define VLD_OPT_SLOW_DEBUGGER_DUMP 0x0040 // If set, inserts a slight delay between sending output to the debugger.
|
||||||
|
#define VLD_OPT_START_DISABLED 0x0080 // If set, memory leak detection will initially disabled.
|
||||||
|
#define VLD_OPT_TRACE_INTERNAL_FRAMES 0x0100 // If set, include useless frames (e.g. internal to VLD) in call stacks.
|
||||||
|
#define VLD_OPT_UNICODE_REPORT 0x0200 // If set, the leak report will be encoded UTF-16 instead of ASCII.
|
||||||
|
#define VLD_OPT_VLDOFF 0x0400 // If set, VLD will be completely deactivated. It will not attach to any modules.
|
||||||
|
#define VLD_OPT_REPORT_TO_STDOUT 0x0800 // If set, the memory leak report is sent to stdout.
|
||||||
|
#define VLD_OPT_SKIP_HEAPFREE_LEAKS 0x1000 // If set, VLD skip HeapFree memory leaks.
|
||||||
|
#define VLD_OPT_VALIDATE_HEAPFREE 0x2000 // If set, VLD verifies and reports heap consistency for HeapFree calls.
|
||||||
|
#define VLD_OPT_RELEASE_CRT_RUNTIME 0x4000 // If set, VLD treat CRT runtime as release version (use only with define VLD_FORCE_ENABLE).
|
||||||
|
|
||||||
|
#define VLD_RPTHOOK_INSTALL 0
|
||||||
|
#define VLD_RPTHOOK_REMOVE 1
|
||||||
|
|
||||||
|
typedef int (__cdecl * VLD_REPORT_HOOK)(int reportType, wchar_t *message, int *returnValue);
|
BIN
etc/vld/lib/Win32/vld.lib
Normal file
BIN
etc/vld/lib/Win32/vld.lib
Normal file
Binary file not shown.
BIN
etc/vld/lib/Win64/vld.lib
Normal file
BIN
etc/vld/lib/Win64/vld.lib
Normal file
Binary file not shown.
@ -608,7 +608,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>actionExit</sender>
|
<sender>actionExit</sender>
|
||||||
<signal>activated()</signal>
|
<signal>triggered()</signal>
|
||||||
<receiver>MainWindow</receiver>
|
<receiver>MainWindow</receiver>
|
||||||
<slot>close()</slot>
|
<slot>close()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
|
@ -66,6 +66,7 @@ typedef AVS_ScriptEnvironment* (__stdcall *avs_create_script_environment_func)(i
|
|||||||
typedef AVS_Value (__stdcall *avs_invoke_func)(AVS_ScriptEnvironment *, const char * name, AVS_Value args, const char** arg_names);
|
typedef AVS_Value (__stdcall *avs_invoke_func)(AVS_ScriptEnvironment *, const char * name, AVS_Value args, const char** arg_names);
|
||||||
typedef int (__stdcall *avs_function_exists_func)(AVS_ScriptEnvironment *, const char * name);
|
typedef int (__stdcall *avs_function_exists_func)(AVS_ScriptEnvironment *, const char * name);
|
||||||
typedef void (__stdcall *avs_delete_script_environment_func)(AVS_ScriptEnvironment *);
|
typedef void (__stdcall *avs_delete_script_environment_func)(AVS_ScriptEnvironment *);
|
||||||
|
typedef void (__stdcall *avs_release_value_func)(AVS_Value);
|
||||||
|
|
||||||
/* Inline functions */
|
/* Inline functions */
|
||||||
inline static int avs_is_int(AVS_Value v) { return v.type == 'i'; }
|
inline static int avs_is_int(AVS_Value v) { return v.type == 'i'; }
|
||||||
|
@ -399,27 +399,26 @@ bool x264_portable(void)
|
|||||||
*/
|
*/
|
||||||
const QString &x264_data_path(void)
|
const QString &x264_data_path(void)
|
||||||
{
|
{
|
||||||
static QString *pathCache = NULL;
|
static QString pathCache;
|
||||||
|
|
||||||
if(!pathCache)
|
if(pathCache.isNull())
|
||||||
{
|
{
|
||||||
pathCache = new QString();
|
|
||||||
if(!x264_portable())
|
if(!x264_portable())
|
||||||
{
|
{
|
||||||
*pathCache = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
pathCache = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
|
||||||
}
|
}
|
||||||
if(pathCache->isEmpty() || x264_portable())
|
if(pathCache.isEmpty() || x264_portable())
|
||||||
{
|
{
|
||||||
*pathCache = QApplication::applicationDirPath();
|
pathCache = QApplication::applicationDirPath();
|
||||||
}
|
}
|
||||||
if(!QDir(*pathCache).mkpath("."))
|
if(!QDir(pathCache).mkpath("."))
|
||||||
{
|
{
|
||||||
qWarning("Data directory could not be created:\n%s\n", pathCache->toUtf8().constData());
|
qWarning("Data directory could not be created:\n%s\n", pathCache.toUtf8().constData());
|
||||||
*pathCache = QDir::currentPath();
|
pathCache = QDir::currentPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return *pathCache;
|
return pathCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -933,5 +932,22 @@ SIZE_T x264_dbg_private_bytes(void)
|
|||||||
*/
|
*/
|
||||||
void x264_finalization(void)
|
void x264_finalization(void)
|
||||||
{
|
{
|
||||||
/* NOP */
|
//Destroy Qt application object
|
||||||
|
QApplication *application = dynamic_cast<QApplication*>(QApplication::instance());
|
||||||
|
X264_DELETE(application);
|
||||||
|
|
||||||
|
//Free STDOUT and STDERR buffers
|
||||||
|
if(g_x264_console_attached)
|
||||||
|
{
|
||||||
|
if(std::filebuf *tmp = dynamic_cast<std::filebuf*>(std::cout.rdbuf()))
|
||||||
|
{
|
||||||
|
std::cout.rdbuf(NULL);
|
||||||
|
X264_DELETE(tmp);
|
||||||
|
}
|
||||||
|
if(std::filebuf *tmp = dynamic_cast<std::filebuf*>(std::cerr.rdbuf()))
|
||||||
|
{
|
||||||
|
std::cerr.rdbuf(NULL);
|
||||||
|
X264_DELETE(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
22
src/global.h
22
src/global.h
@ -33,6 +33,9 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
//VLD
|
||||||
|
#include <vld.h>
|
||||||
|
|
||||||
//Debug build
|
//Debug build
|
||||||
#if defined(_DEBUG) && defined(QT_DEBUG) && !defined(NDEBUG) && !defined(QT_NO_DEBUG)
|
#if defined(_DEBUG) && defined(QT_DEBUG) && !defined(NDEBUG) && !defined(QT_NO_DEBUG)
|
||||||
#define X264_DEBUG (1)
|
#define X264_DEBUG (1)
|
||||||
@ -40,19 +43,26 @@
|
|||||||
#define X264_DEBUG (0)
|
#define X264_DEBUG (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Memory leack checker
|
//Memory check
|
||||||
#if X264_DEBUG
|
#if X264_DEBUG
|
||||||
#define X264_MEMORY_CHECK(CMD) \
|
#define X264_MEMORY_CHECK(FUNC, RETV, ...) \
|
||||||
{ \
|
{ \
|
||||||
SIZE_T _privateBytesBefore = x264_dbg_private_bytes(); \
|
SIZE_T _privateBytesBefore = x264_dbg_private_bytes(); \
|
||||||
CMD; \
|
RETV = FUNC(__VA_ARGS__); \
|
||||||
SIZE_T _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \
|
SIZE_T _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \
|
||||||
if(_privateBytesLeak > 10) { \
|
if(_privateBytesLeak > 0) { \
|
||||||
qWarning("Memory leak: Lost %u KiloBytes.", _privateBytesLeak); \
|
char _buffer[128]; \
|
||||||
|
_snprintf_s(_buffer, 128, _TRUNCATE, "Memory leak: Lost %u KiloBytes of PrivateUsage memory.\n", _privateBytesLeak); \
|
||||||
|
OutputDebugStringA("----------\n"); \
|
||||||
|
OutputDebugStringA(_buffer); \
|
||||||
|
OutputDebugStringA("----------\n"); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define X264_MEMORY_CHECK(CMD) CMD
|
#define X264_MEMORY_CHECK(FUNC, RETV, ...) \
|
||||||
|
{ \
|
||||||
|
RETV = __noop(__VA_ARGS__); \
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Helper macros
|
//Helper macros
|
||||||
|
@ -108,7 +108,7 @@ static int _main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
int iResult = -1;
|
int iResult = -1;
|
||||||
qInstallMsgHandler(x264_message_handler);
|
qInstallMsgHandler(x264_message_handler);
|
||||||
X264_MEMORY_CHECK(iResult = x264_main(argc, argv));
|
X264_MEMORY_CHECK(x264_main, iResult, argc, argv);
|
||||||
x264_finalization();
|
x264_finalization();
|
||||||
return iResult;
|
return iResult;
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 0
|
#define VER_X264_MINOR 0
|
||||||
#define VER_X264_PATCH 4
|
#define VER_X264_PATCH 4
|
||||||
#define VER_X264_BUILD 295
|
#define VER_X264_BUILD 312
|
||||||
|
|
||||||
#define VER_X264_MINIMUM_REV 2164
|
#define VER_X264_MINIMUM_REV 2189
|
||||||
#define VER_X264_CURRENT_API 122
|
#define VER_X264_CURRENT_API 124
|
||||||
#define VER_X264_AVS2YUV_VER 242
|
#define VER_X264_AVS2YUV_VER 242
|
||||||
|
|
||||||
#define VER_X264_PRE_RELEASE (0)
|
#define VER_X264_PRE_RELEASE (0)
|
||||||
|
@ -279,7 +279,19 @@ AddJobDialog::~AddJobDialog(void)
|
|||||||
cbxTemplate->setItemData(i, QVariant::fromValue<void*>(NULL));
|
cbxTemplate->setItemData(i, QVariant::fromValue<void*>(NULL));
|
||||||
X264_DELETE(item);
|
X264_DELETE(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Free validators
|
||||||
|
if(const QValidator *tmp = editCustomX264Params->validator())
|
||||||
|
{
|
||||||
|
editCustomX264Params->setValidator(NULL);
|
||||||
|
X264_DELETE(tmp);
|
||||||
|
}
|
||||||
|
if(const QValidator *tmp = editCustomAvs2YUVParams->validator())
|
||||||
|
{
|
||||||
|
editCustomAvs2YUVParams->setValidator(NULL);
|
||||||
|
X264_DELETE(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
X264_DELETE(m_defaults);
|
X264_DELETE(m_defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ MainWindow::MainWindow(const x264_cpu_t *const cpuFeatures)
|
|||||||
m_appDir(QApplication::applicationDirPath()),
|
m_appDir(QApplication::applicationDirPath()),
|
||||||
m_options(NULL),
|
m_options(NULL),
|
||||||
m_jobList(NULL),
|
m_jobList(NULL),
|
||||||
|
m_avsLib(NULL),
|
||||||
m_droppedFiles(NULL),
|
m_droppedFiles(NULL),
|
||||||
m_firstShow(true)
|
m_firstShow(true)
|
||||||
{
|
{
|
||||||
@ -194,6 +195,12 @@ MainWindow::~MainWindow(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
X264_DELETE(m_ipcThread);
|
X264_DELETE(m_ipcThread);
|
||||||
|
|
||||||
|
if(m_avsLib)
|
||||||
|
{
|
||||||
|
m_avsLib->unload();
|
||||||
|
X264_DELETE(m_avsLib);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -726,11 +733,15 @@ void MainWindow::init(void)
|
|||||||
//Check for Avisynth support
|
//Check for Avisynth support
|
||||||
if(!qApp->arguments().contains("--skip-avisynth-check", Qt::CaseInsensitive))
|
if(!qApp->arguments().contains("--skip-avisynth-check", Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
|
qDebug("[Check for Avisynth support]");
|
||||||
double avisynthVersion = 0.0;
|
double avisynthVersion = 0.0;
|
||||||
QLibrary *avsLib = new QLibrary("avisynth.dll");
|
if(!m_avsLib)
|
||||||
if(avsLib->load())
|
|
||||||
{
|
{
|
||||||
avisynthVersion = detectAvisynthVersion(avsLib);
|
m_avsLib = new QLibrary("avisynth.dll");
|
||||||
|
}
|
||||||
|
if(m_avsLib->load())
|
||||||
|
{
|
||||||
|
avisynthVersion = detectAvisynthVersion(m_avsLib);
|
||||||
if(avisynthVersion < 0.0)
|
if(avisynthVersion < 0.0)
|
||||||
{
|
{
|
||||||
int val = QMessageBox::critical(this, tr("Avisynth Error"), tr("<nobr>A critical error was encountered while checking your Avisynth version!</nobr>").replace("-", "−"), tr("Quit"), tr("Ignore"));
|
int val = QMessageBox::critical(this, tr("Avisynth Error"), tr("<nobr>A critical error was encountered while checking your Avisynth version!</nobr>").replace("-", "−"), tr("Quit"), tr("Ignore"));
|
||||||
@ -740,7 +751,7 @@ void MainWindow::init(void)
|
|||||||
if(avisynthVersion < 2.5)
|
if(avisynthVersion < 2.5)
|
||||||
{
|
{
|
||||||
int val = QMessageBox::warning(this, tr("Avisynth Missing"), tr("<nobr>It appears that Avisynth is <b>not</b> currently installed on your computer.<br>Therefore Avisynth (.avs) input will <b>not</b> be working at all!<br><br>Please download and install Avisynth:<br><a href=\"http://sourceforge.net/projects/avisynth2/files/AviSynth%202.5/\">http://sourceforge.net/projects/avisynth2/files/AviSynth 2.5/</a></nobr>").replace("-", "−"), tr("Quit"), tr("Ignore"));
|
int val = QMessageBox::warning(this, tr("Avisynth Missing"), tr("<nobr>It appears that Avisynth is <b>not</b> currently installed on your computer.<br>Therefore Avisynth (.avs) input will <b>not</b> be working at all!<br><br>Please download and install Avisynth:<br><a href=\"http://sourceforge.net/projects/avisynth2/files/AviSynth%202.5/\">http://sourceforge.net/projects/avisynth2/files/AviSynth 2.5/</a></nobr>").replace("-", "−"), tr("Quit"), tr("Ignore"));
|
||||||
avsLib->unload(); X264_DELETE(avsLib);
|
m_avsLib->unload(); X264_DELETE(m_avsLib);
|
||||||
if(val != 1) { close(); qApp->exit(-1); return; }
|
if(val != 1) { close(); qApp->exit(-1); return; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1100,6 +1111,7 @@ void MainWindow::updateTaskbar(EncodeThread::JobStatus status, const QIcon &icon
|
|||||||
*/
|
*/
|
||||||
double MainWindow::detectAvisynthVersion(QLibrary *avsLib)
|
double MainWindow::detectAvisynthVersion(QLibrary *avsLib)
|
||||||
{
|
{
|
||||||
|
qDebug("detectAvisynthVersion(QLibrary *avsLib)");
|
||||||
double version_number = 0.0;
|
double version_number = 0.0;
|
||||||
|
|
||||||
__try
|
__try
|
||||||
@ -1108,14 +1120,18 @@ double MainWindow::detectAvisynthVersion(QLibrary *avsLib)
|
|||||||
avs_invoke_func avs_invoke_ptr = (avs_invoke_func) avsLib->resolve("avs_invoke");
|
avs_invoke_func avs_invoke_ptr = (avs_invoke_func) avsLib->resolve("avs_invoke");
|
||||||
avs_function_exists_func avs_function_exists_ptr = (avs_function_exists_func) avsLib->resolve("avs_function_exists");
|
avs_function_exists_func avs_function_exists_ptr = (avs_function_exists_func) avsLib->resolve("avs_function_exists");
|
||||||
avs_delete_script_environment_func avs_delete_script_environment_ptr = (avs_delete_script_environment_func) avsLib->resolve("avs_delete_script_environment");
|
avs_delete_script_environment_func avs_delete_script_environment_ptr = (avs_delete_script_environment_func) avsLib->resolve("avs_delete_script_environment");
|
||||||
|
avs_release_value_func avs_release_value_ptr = (avs_release_value_func) avsLib->resolve("avs_release_value");
|
||||||
|
|
||||||
if((avs_create_script_environment_ptr != NULL) && (avs_invoke_ptr != NULL) && (avs_function_exists_ptr != NULL))
|
if((avs_create_script_environment_ptr != NULL) && (avs_invoke_ptr != NULL) && (avs_function_exists_ptr != NULL))
|
||||||
{
|
{
|
||||||
|
qDebug("avs_create_script_environment_ptr(AVS_INTERFACE_25)");
|
||||||
AVS_ScriptEnvironment* avs_env = avs_create_script_environment_ptr(AVS_INTERFACE_25);
|
AVS_ScriptEnvironment* avs_env = avs_create_script_environment_ptr(AVS_INTERFACE_25);
|
||||||
if(avs_env != NULL)
|
if(avs_env != NULL)
|
||||||
{
|
{
|
||||||
|
qDebug("avs_function_exists_ptr(avs_env, \"VersionNumber\")");
|
||||||
if(avs_function_exists_ptr(avs_env, "VersionNumber"))
|
if(avs_function_exists_ptr(avs_env, "VersionNumber"))
|
||||||
{
|
{
|
||||||
|
qDebug("avs_invoke_ptr(avs_env, \"VersionNumber\", avs_new_value_array(NULL, 0), NULL)");
|
||||||
AVS_Value avs_version = avs_invoke_ptr(avs_env, "VersionNumber", avs_new_value_array(NULL, 0), NULL);
|
AVS_Value avs_version = avs_invoke_ptr(avs_env, "VersionNumber", avs_new_value_array(NULL, 0), NULL);
|
||||||
if(!avs_is_error(avs_version))
|
if(!avs_is_error(avs_version))
|
||||||
{
|
{
|
||||||
@ -1123,8 +1139,21 @@ double MainWindow::detectAvisynthVersion(QLibrary *avsLib)
|
|||||||
{
|
{
|
||||||
qDebug("Avisynth version: v%.2f", avs_as_float(avs_version));
|
qDebug("Avisynth version: v%.2f", avs_as_float(avs_version));
|
||||||
version_number = avs_as_float(avs_version);
|
version_number = avs_as_float(avs_version);
|
||||||
|
if(avs_release_value_ptr) avs_release_value_ptr(avs_version);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("Failed to determine version number, Avisynth didn't return a float!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("Failed to determine version number, Avisynth returned an error!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("The 'VersionNumber' function does not exist in your Avisynth DLL, can't determine version!");
|
||||||
}
|
}
|
||||||
if(avs_delete_script_environment_ptr != NULL)
|
if(avs_delete_script_environment_ptr != NULL)
|
||||||
{
|
{
|
||||||
@ -1132,6 +1161,10 @@ double MainWindow::detectAvisynthVersion(QLibrary *avsLib)
|
|||||||
avs_env = NULL;
|
avs_env = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("The Avisynth DLL failed to create the script environment!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,7 @@ private:
|
|||||||
bool m_firstShow;
|
bool m_firstShow;
|
||||||
QLabel *m_label;
|
QLabel *m_label;
|
||||||
IPCThread *m_ipcThread;
|
IPCThread *m_ipcThread;
|
||||||
|
QLibrary *m_avsLib;
|
||||||
|
|
||||||
JobListModel *m_jobList;
|
JobListModel *m_jobList;
|
||||||
OptionsModel *m_options;
|
OptionsModel *m_options;
|
||||||
|
@ -55,18 +55,20 @@
|
|||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;QT_DEBUG;QT_DLL;QT_GUI_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;QT_DEBUG;QT_DLL;QT_GUI_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtTest;$(SolutionDir)tmp\uic;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtTest;$(SolutionDir)tmp\uic;$(SolutionDir)etc\vld\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(QTDIR)\lib;$(SolutionDir)etc\vld\lib\Win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>QtMaind.lib;QtCored4.lib;QtGuid4.lib;Winmm.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>QtMaind.lib;QtCored4.lib;QtGuid4.lib;Winmm.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>rmdir /S /Q "$(SolutionDir)bin\$(Configuration)\toolset"
|
<Command>rmdir /S /Q "$(SolutionDir)bin\$(Configuration)\toolset"
|
||||||
mkdir "$(SolutionDir)bin\$(Configuration)\toolset"
|
mkdir "$(SolutionDir)bin\$(Configuration)\toolset"
|
||||||
copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\toolset"
|
copy /Y "$(SolutionDir)res\toolset\*.exe" "$(TargetDir)\toolset"
|
||||||
|
copy /Y "$(SolutionDir)etc\vld\bin\Win32\*.dll" "$(TargetDir)"
|
||||||
|
copy /Y "$(SolutionDir)etc\vld\bin\Win32\*.manifest" "$(TargetDir)"
|
||||||
</Command>
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
@ -85,7 +87,7 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
|
|||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;QT_NO_DEBUG;QT_DLL;QT_GUI_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;QT_NO_DEBUG;QT_DLL;QT_GUI_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtTest;$(SolutionDir)tmp\uic;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include\QtTest;$(SolutionDir)tmp\uic;$(SolutionDir)etc\vld\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
@ -120,9 +122,9 @@ copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\tools
|
|||||||
</Message>
|
</Message>
|
||||||
</PreLinkEvent>
|
</PreLinkEvent>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>rmdir /S /Q "$(SolutionDir)bin\$(Configuration)\toolset"
|
<Command>rmdir /S /Q "$(TargetDir)\toolset"
|
||||||
mkdir "$(SolutionDir)bin\$(Configuration)\toolset"
|
mkdir "$(TargetDir)\toolset"
|
||||||
copy "$(SolutionDir)res\toolset\*.exe" "$(SolutionDir)bin\$(Configuration)\toolset"
|
copy /Y "$(SolutionDir)res\toolset\*.exe" "$(TargetDir)\toolset\"
|
||||||
</Command>
|
</Command>
|
||||||
<Message>Copy Toolset</Message>
|
<Message>Copy Toolset</Message>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
|
Loading…
Reference in New Issue
Block a user