[svn] GpgOL - r304 - trunk/src

svn author wk cvs at cvs.gnupg.org
Fri Aug 21 12:29:39 CEST 2009


Author: wk
Date: 2009-08-21 12:29:39 +0200 (Fri, 21 Aug 2009)
New Revision: 304

Modified:
   trunk/src/ChangeLog
   trunk/src/common.h
   trunk/src/engine-assuan.c
   trunk/src/item-events.cpp
   trunk/src/main.c
   trunk/src/message.cpp
   trunk/src/ol-ext-callback.cpp
   trunk/src/session-events.cpp
Log:
Do not use MSgWautForMultipleObjects


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/ChangeLog	2009-08-21 10:29:39 UTC (rev 304)
@@ -1,3 +1,18 @@
+2009-08-21  Werner Koch  <wk at g10code.com>
+
+	* engine-assuan.c (async_worker_thread): Disable the use of
+	MsgWaitForMultipleObjects.
+	* common.h (struct compat): Add USE_MWFMO.
+	* main.c (read_options): Read that flag.
+
+2009-08-19  Werner Koch  <wk at g10code.com>
+
+	* message.cpp (ul_release): Add arg LNR.  Change all callers.
+	* ol-ext-callback.cpp (ul_release): Add args FUNC and LNR.  Change
+	all callers.
+	* item-events.cpp (ul_release): ditto.
+	* session-events.cpp (ul_release): Ditto.
+
 2009-07-21  Werner Koch  <wk at g10code.com>
 
 	* mapihelp.cpp (create_gpgol_tag, get_internetcharsetbody_tag) 

Modified: trunk/src/common.h
===================================================================
--- trunk/src/common.h	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/common.h	2009-08-21 10:29:39 UTC (rev 304)
@@ -130,6 +130,7 @@
     unsigned int old_reply_hack: 1; /* See gpgmsg.cpp:decrypt. */
     unsigned int auto_decrypt: 1;   /* Try to decrypt when clicked. */
     unsigned int no_attestation: 1; /* Don't create an attestation. */
+    unsigned int use_mwfmo: 1;      /* Use MsgWaitForMultipleObjects.  */
   } compat; 
 
   /* The SVN revision as stored in the registry.  */

Modified: trunk/src/engine-assuan.c
===================================================================
--- trunk/src/engine-assuan.c	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/engine-assuan.c	2009-08-21 10:29:39 UTC (rev 304)
@@ -872,9 +872,15 @@
   DWORD nbytes;
   HANDLE hdarray[MAXIMUM_WAIT_OBJECTS];
   int count, addit, any_ready, hdarraylen;
+  /* Due to problems opening stuff with Internet exploder, Word or
+     Wordview, we can't use MsgWaitForMultipleObjects and the event
+     loops.  For test purposes a compatibiliy option allows to revert
+     to the old behaviour. */
+  int msgwait = opt.compat.use_mwfmo; 
+
   
-  attach_thread_input ( (DWORD)dummy );
-  (void)dummy;
+  if (msgwait)
+    attach_thread_input ( (DWORD)dummy );
 
   for (;;)
     {
@@ -965,27 +971,31 @@
                                SRCNAME, __func__, item->name, item->hd);
                 }
             }
-          /* [Currently not used]
-             First process any window messages of this thread.  Do
+
+          /* First process any window messages of this thread.  Do
              this before wating so that the message queue is cleared
              before waiting and we don't get stucked due to messages
              not removed.  We need to process the message queue also
              after the wait because we will only get to here if there
              is actual ui-server work to be done but some messages
              might still be in the queue.  */
-          {
-            MSG msg;
-
-            while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
-              {
-                TranslateMessage (&msg);
-                DispatchMessage (&msg);
-              }
-          }
-
-/*           n = WaitForMultipleObjects (hdarraylen, hdarray, FALSE, INFINITE); */
-          n = MsgWaitForMultipleObjects (hdarraylen, hdarray, FALSE,
-                                         INFINITE, QS_ALLEVENTS);
+          if (msgwait)
+            {
+              MSG msg;
+              
+              while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
+                {
+                  TranslateMessage (&msg);
+                  DispatchMessage (&msg);
+                }
+              n = MsgWaitForMultipleObjects (hdarraylen, hdarray, FALSE,
+                                             INFINITE, QS_ALLEVENTS);
+            }
+          else
+            {
+              n = WaitForMultipleObjects (hdarraylen, hdarray, FALSE,
+                                          INFINITE);
+            }
           if (n == WAIT_FAILED)
             {
               /* The WFMO failed.  This is an error; to help debugging
@@ -1026,19 +1036,18 @@
               Sleep (1000);
             }
 
-          /* [Currently not used] 
-             Try to process the message queue.  */
-          {
-            MSG msg;
-            
-            while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
-              {
-                TranslateMessage (&msg);
-                DispatchMessage (&msg);
-              }
-          }
+          if (msgwait)
+            {
+              MSG msg;
+              
+              while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
+                {
+                  TranslateMessage (&msg);
+                  DispatchMessage (&msg);
+                }
+            }
         }
-
+      
       /*
          Step 3: Handle I/O completion status.
        */

Modified: trunk/src/item-events.cpp
===================================================================
--- trunk/src/item-events.cpp	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/item-events.cpp	2009-08-21 10:29:39 UTC (rev 304)
@@ -41,9 +41,8 @@
 
 
 /* Wrapper around UlRelease with error checking. */
-/* FIXME: Duplicated code.  */
 static void 
-ul_release (LPVOID punk)
+ul_release (LPVOID punk, const char *func, int lnr)
 {
   ULONG res;
   
@@ -51,12 +50,14 @@
     return;
   res = UlRelease (punk);
   if (opt.enable_debug & DBG_MEMORY)
-    log_debug ("%s UlRelease(%p) had %lu references\n", __func__, punk, res);
+    log_debug ("%s:%s:%d: UlRelease(%p) had %lu references\n", 
+               SRCNAME, func, lnr, punk, res);
 }
 
 
 
 
+
 /* Our constructor.  */
 GpgolItemEvents::GpgolItemEvents (GpgolExt *pParentInterface)
 { 
@@ -109,8 +110,8 @@
   eecb->GetObject (&mdb, (LPMAPIPROP *)&message);
   if (message_incoming_handler (message, hwnd, false))
     m_processed = TRUE;
-  ul_release (message);
-  ul_release (mdb);
+  ul_release (message, __func__, __LINE__);
+  ul_release (mdb, __func__, __LINE__);
 
   return S_FALSE;
 }
@@ -194,8 +195,8 @@
         log_debug_w32 (hr, "%s:%s: error getting message", 
                        SRCNAME, __func__);
      
-      ul_release (message);
-      ul_release (mdb);
+      ul_release (message, __func__, __LINE__);
+      ul_release (mdb, __func__, __LINE__);
     }
 
   return S_FALSE;

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/main.c	2009-08-21 10:29:39 UTC (rev 304)
@@ -669,6 +669,7 @@
             case 4: opt.compat.old_reply_hack = x; break;
             case 5: opt.compat.auto_decrypt = x; break;
             case 6: opt.compat.no_attestation = x; break;
+            case 7: opt.compat.use_mwfmo = x; break;
             }
         }
       log_debug ("Note: using compatibility flags: %s", val);

Modified: trunk/src/message.cpp
===================================================================
--- trunk/src/message.cpp	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/message.cpp	2009-08-21 10:29:39 UTC (rev 304)
@@ -38,8 +38,9 @@
                         } while (0)
 
 
+/* Wrapper around UlRelease with error checking. */
 static void 
-ul_release (LPVOID punk, const char *func)
+ul_release (LPVOID punk, const char *func, int lnr)
 {
   ULONG res;
   
@@ -47,8 +48,8 @@
     return;
   res = UlRelease (punk);
   if (opt.enable_debug & DBG_MEMORY)
-    log_debug ("%s:%s: UlRelease(%p) had %lu references\n", 
-               SRCNAME, func, punk, res);
+    log_debug ("%s:%s:%d: UlRelease(%p) had %lu references\n", 
+               SRCNAME, func, lnr, punk, res);
 }
 
 
@@ -198,8 +199,8 @@
   else
     log_debug_w32 (hr, "%s:%s: error getting message", SRCNAME, __func__);
 
-  ul_release (message, __func__);
-  ul_release (mdb, __func__);
+  ul_release (message, __func__, __LINE__);
+  ul_release (mdb, __func__, __LINE__);
 
   return !!wasprotected;
 }
@@ -277,8 +278,8 @@
           break;
         }
       
-      ul_release (message, __func__);
-      ul_release (mdb, __func__);
+      ul_release (message, __func__, __LINE__);
+      ul_release (mdb, __func__, __LINE__);
     }
 }
 

Modified: trunk/src/ol-ext-callback.cpp
===================================================================
--- trunk/src/ol-ext-callback.cpp	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/ol-ext-callback.cpp	2009-08-21 10:29:39 UTC (rev 304)
@@ -41,9 +41,8 @@
 
 
 /* Wrapper around UlRelease with error checking. */
-/* FIXME: Duplicated code.  */
 static void 
-ul_release (LPVOID punk)
+ul_release (LPVOID punk, const char *func, int lnr)
 {
   ULONG res;
   
@@ -51,13 +50,15 @@
     return;
   res = UlRelease (punk);
   if (opt.enable_debug & DBG_MEMORY)
-    log_debug ("%s UlRelease(%p) had %lu references\n", __func__, punk, res);
+    log_debug ("%s:%s:%d: UlRelease(%p) had %lu references\n", 
+               SRCNAME, func, lnr, punk, res);
 }
 
 
 
 
 
+
 /* Locate a property using the provided callback LPEECB and traverse
    down to the last element of the dot delimited NAME.  Returns the
    Dispatch object and if R_DISPID is not NULL, the dispatch-id of the
@@ -194,8 +195,8 @@
       result = 0;
     }
 
-  ul_release (pMessage);
-  ul_release (pMDB);
+  ul_release (pMessage, __func__, __LINE__);
+  ul_release (pMDB, __func__, __LINE__);
   return result;
 }
 
@@ -238,8 +239,8 @@
       result = 0;
     }
 
-  ul_release (pMessage);
-  ul_release (pMDB);
+  ul_release (pMessage, __func__, __LINE__);
+  ul_release (pMDB, __func__, __LINE__);
   return result;
 }
 

Modified: trunk/src/session-events.cpp
===================================================================
--- trunk/src/session-events.cpp	2009-07-21 15:38:47 UTC (rev 303)
+++ trunk/src/session-events.cpp	2009-08-21 10:29:39 UTC (rev 304)
@@ -44,9 +44,8 @@
 
 
 /* Wrapper around UlRelease with error checking. */
-/* FIXME: Duplicated code.  */
 static void 
-ul_release (LPVOID punk)
+ul_release (LPVOID punk, const char *func, int lnr)
 {
   ULONG res;
   
@@ -54,15 +53,12 @@
     return;
   res = UlRelease (punk);
   if (opt.enable_debug & DBG_MEMORY)
-    log_debug ("%s UlRelease(%p) had %lu references\n", __func__, punk, res);
+    log_debug ("%s:%s:%d: UlRelease(%p) had %lu references\n", 
+               SRCNAME, func, lnr, punk, res);
 }
 
 
 
-
-
-
-
 /* Our constructor.  */
 GpgolSessionEvents::GpgolSessionEvents (GpgolExt *pParentInterface)
 { 
@@ -113,8 +109,8 @@
          later (before an OnRead) to IPM.Note. */
       mapi_change_message_class (pMessage, 0);
       log_mapi_property (pMessage, PR_MESSAGE_CLASS,"PR_MESSAGE_CLASS");
-      ul_release (pMessage);
-      ul_release (pMDB);
+      ul_release (pMessage, __func__, __LINE__);
+      ul_release (pMDB, __func__, __LINE__);
     }
 
   return S_FALSE;




More information about the Gnupg-commits mailing list