Mike McCormack : msi: Create a function to free control data.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 21 08:14:48 CST 2006


Module: wine
Branch: master
Commit: 6a2fb054514ac56c8d330466d96cc11f05eed821
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6a2fb054514ac56c8d330466d96cc11f05eed821

Author: Mike McCormack <mike at codeweavers.com>
Date:   Tue Nov 21 13:47:58 2006 +0900

msi: Create a function to free control data.

---

 dlls/msi/dialog.c |   41 ++++++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c
index 44c56f6..c13bcc4 100644
--- a/dlls/msi/dialog.c
+++ b/dlls/msi/dialog.c
@@ -373,6 +373,23 @@ static UINT msi_dialog_build_font_list(
     return r;
 }
 
+static void msi_destroy_control( msi_control *t )
+{
+    list_remove( &t->entry );
+    /* leave dialog->hwnd - destroying parent destroys child windows */
+    msi_free( t->property );
+    msi_free( t->value );
+    if( t->hBitmap )
+        DeleteObject( t->hBitmap );
+    if( t->hIcon )
+        DestroyIcon( t->hIcon );
+    msi_free( t->tabnext );
+    msi_free( t->type );
+    if (t->hDll)
+        FreeLibrary( t->hDll );
+    msi_free( t );
+}
+
 static msi_control *msi_dialog_create_window( msi_dialog *dialog,
                 MSIRECORD *rec, DWORD exstyle, LPCWSTR szCls, LPCWSTR name, LPCWSTR text,
                 DWORD style, HWND parent )
@@ -3150,7 +3167,7 @@ static LRESULT WINAPI MSIDialog_WndProc(
         dialog->package->center_x = LOWORD(lParam) + dialog->size.cx / 2.0;
         dialog->package->center_y = HIWORD(lParam) + dialog->size.cy / 2.0;
         break;
-        
+
     case WM_CREATE:
         return msi_dialog_oncreate( hwnd, (LPCREATESTRUCTW)lParam );
 
@@ -3370,28 +3387,18 @@ void msi_dialog_destroy( msi_dialog *dia
 
     if( dialog->hwnd )
         ShowWindow( dialog->hwnd, SW_HIDE );
-    
+
     if( dialog->hwnd )
         DestroyWindow( dialog->hwnd );
 
     /* destroy the list of controls */
     while( !list_empty( &dialog->controls ) )
     {
-        msi_control *t = LIST_ENTRY( list_head( &dialog->controls ),
-                                     msi_control, entry );
-        list_remove( &t->entry );
-        /* leave dialog->hwnd - destroying parent destroys child windows */
-        msi_free( t->property );
-        msi_free( t->value );
-        if( t->hBitmap )
-            DeleteObject( t->hBitmap );
-        if( t->hIcon )
-            DestroyIcon( t->hIcon );
-        msi_free( t->tabnext );
-        msi_free( t->type );
-        if (t->hDll)
-            FreeLibrary( t->hDll );
-        msi_free( t );
+        msi_control *t;
+
+        t = LIST_ENTRY( list_head( &dialog->controls ),
+                        msi_control, entry );
+        msi_destroy_control( t );
     }
 
     /* destroy the list of fonts */




More information about the wine-cvs mailing list