X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/62e83765c26fa613df0c97f4ad9355f691b048b7..33754c4d83c59b7523a6da0c4fb21079cb60301c:/src/mac/gsocket.c diff --git a/src/mac/gsocket.c b/src/mac/gsocket.c index 49b8a92142..ef89f1a511 100644 --- a/src/mac/gsocket.c +++ b/src/mac/gsocket.c @@ -84,7 +84,7 @@ extern pascal void OTDebugStr(const char* str); #include #endif InetSvcRef gInetSvcRef = 0 ; - +int gOTInited = 0 ; OSStatus DoNegotiateIPReuseAddrOption(EndpointRef ep, Boolean enableReuseIPMode); @@ -211,6 +211,7 @@ int GSocket_Verify_Inited() return TRUE ; InitOpenTransportInContext(kInitOTForApplicationMask, &clientcontext); + gOTInited = 1 ; gInetSvcRef = OTOpenInternetServicesInContext(kDefaultInternetServicesPath, NULL, &err, clientcontext); #else @@ -218,6 +219,7 @@ int GSocket_Verify_Inited() return TRUE ; InitOpenTransport() ; + gOTInited = 1 ; gInetSvcRef = OTOpenInternetServices(kDefaultInternetServicesPath, NULL, &err); #endif if ( gInetSvcRef == NULL || err != kOTNoError ) @@ -230,13 +232,16 @@ int GSocket_Verify_Inited() void GSocket_Cleanup() { - if ( gInetSvcRef != NULL ) - OTCloseProvider( gInetSvcRef ); -#if TARGET_CARBON - CloseOpenTransportInContext( NULL ) ; -#else - CloseOpenTransport() ; -#endif + if ( gOTInited != 0 ) + { + if ( gInetSvcRef != NULL ) + OTCloseProvider( gInetSvcRef ); + #if TARGET_CARBON + CloseOpenTransportInContext( NULL ) ; + #else + CloseOpenTransport() ; + #endif + } } /* Constructors / Destructors for GSocket */