wxWidgets initialization reference counter introduced to prevent second initialization, as we recorded a case where EapHost called our GUI twice in the same DllHost.exe process.
This commit is contained in:
parent
d9bfcc3e49
commit
0d221d4401
@ -23,6 +23,9 @@
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
static wxCriticalSection s_lock;
|
||||
static unsigned long s_init_ref_count = 0;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxInitializerPeer
|
||||
@ -328,6 +331,10 @@ void eap::peer_ttls_ui::invoke_interactive_ui(
|
||||
|
||||
wxInitializerPeer::wxInitializerPeer(_In_ HINSTANCE instance)
|
||||
{
|
||||
wxCriticalSectionLocker locker(s_lock);
|
||||
if (s_init_ref_count++)
|
||||
return;
|
||||
|
||||
// Initialize application.
|
||||
new wxApp();
|
||||
wxEntryStart(instance);
|
||||
@ -343,5 +350,9 @@ wxInitializerPeer::wxInitializerPeer(_In_ HINSTANCE instance)
|
||||
|
||||
wxInitializerPeer::~wxInitializerPeer()
|
||||
{
|
||||
wxCriticalSectionLocker locker(s_lock);
|
||||
if (--s_init_ref_count)
|
||||
return;
|
||||
|
||||
wxEntryCleanup();
|
||||
}
|
||||
|
@ -28,3 +28,4 @@
|
||||
#include "../../PAP_UI/include/PAP_UI.h"
|
||||
|
||||
#include <wx/app.h>
|
||||
#include <wx/thread.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user