[vlc-commits] Skins2: fix usage of SHFileOperation on Win32

Jean-Baptiste Kempf git at videolan.org
Sun Jan 27 22:34:03 CET 2013


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Jan 27 22:33:31 2013 +0100| [e7d5b1bf9b22750bb3ed0e9b91086e8b55535054] | committer: Jean-Baptiste Kempf

Skins2: fix usage of SHFileOperation on Win32

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e7d5b1bf9b22750bb3ed0e9b91086e8b55535054
---

 modules/gui/skins2/win32/win32_factory.cpp |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/win32/win32_factory.cpp b/modules/gui/skins2/win32/win32_factory.cpp
index 0866fd2..81bc68a 100644
--- a/modules/gui/skins2/win32/win32_factory.cpp
+++ b/modules/gui/skins2/win32/win32_factory.cpp
@@ -479,7 +479,13 @@ void Win32Factory::changeCursor( CursorType_t type ) const
 
 void Win32Factory::rmDir( const string &rPath )
 {
-    LPWSTR dir = ToWide( rPath.c_str() );
+    LPWSTR dir_temp = ToWide( rPath.c_str() );
+    size_t len = wcslen( dir_temp );
+
+    LPWSTR dir = (wchar_t *)malloc( (len + 1) * sizeof (wchar_t) );
+    wcsncpy( dir, dir_temp, len );
+    dir[len] = '\0';
+
     SHFILEOPSTRUCTW file_op = {
         NULL,
         FO_DELETE,
@@ -493,6 +499,9 @@ void Win32Factory::rmDir( const string &rPath )
         L"" };
 
      SHFileOperationW(&file_op);
+
+     free(dir_temp);
+     free(dir);
 }
 
 #endif



More information about the vlc-commits mailing list