diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -876,26 +876,36 @@ WinUtils::GetTopLevelHWND(HWND aWnd,
       upWnd = ::GetWindow(curWnd, GW_OWNER);
     }
     curWnd = upWnd;
   }
 
   return topWnd;
 }
 
+class CAtom_NSWindowPropName {
+public:
+  CAtom_NSWindowPropName() {
+    wchar_t sPropName[40] = L"";
+    _snwprintf(sPropName, 39, L"MozillansIWidgetPtr%u",
+               ::GetCurrentProcessId());
+    sPropName[39] = '\0';
+    atom = ::GlobalAddAtomW(sPropName);
+  }
+  ~CAtom_NSWindowPropName() {
+    ::GlobalDeleteAtom(atom);
+  }
+  ATOM atom;
+};
+
 static const wchar_t*
 GetNSWindowPropName()
 {
-  static wchar_t sPropName[40] = L"";
-  if (!*sPropName) {
-    _snwprintf(sPropName, 39, L"MozillansIWidgetPtr%u",
-               ::GetCurrentProcessId());
-    sPropName[39] = '\0';
-  }
-  return sPropName;
+  static CAtom_NSWindowPropName gaNswpn;
+  return (const wchar_t*)(UINT_PTR)gaNswpn.atom;
 }
 
 /* static */
 bool
 WinUtils::SetNSWindowBasePtr(HWND aWnd, nsWindowBase* aWidget)
 {
   if (!aWidget) {
     ::RemovePropW(aWnd, GetNSWindowPropName());
