File: wxMSW-2.8.10-w64-winhash.patch

package info (click to toggle)
libalien-wxwidgets-perl 0.67%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,248 kB
  • ctags: 439
  • sloc: perl: 5,359; sh: 51; makefile: 18
file content (63 lines) | stat: -rw-r--r-- 1,933 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Index: src/msw/window.cpp
===================================================================
--- src/msw/window.cpp	(revisione 63679)
+++ src/msw/window.cpp	(copia locale)
@@ -3431,11 +3431,17 @@
 // wxWindow <-> HWND map
 // ----------------------------------------------------------------------------
 
-wxWinHashTable *wxWinHandleHash = NULL;
+// hash containing all our windows, it uses HWND keys and wxWindow* values
+WX_DECLARE_HASH_MAP(HWND, wxWindow *,
+                    wxPointerHash, wxPointerEqual,
+                    WindowHandles);
 
+WindowHandles gs_windowHandles;
+
 wxWindow *wxFindWinFromHandle(WXHWND hWnd)
 {
-    return (wxWindow*)wxWinHandleHash->Get((long)hWnd);
+    WindowHandles::const_iterator i = gs_windowHandles.find((HWND)hWnd);
+    return i == gs_windowHandles.end() ? NULL : i->second;
 }
 
 void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win)
@@ -3449,13 +3455,13 @@
 #endif // __WXDEBUG__
     if (!oldWin)
     {
-        wxWinHandleHash->Put((long)hWnd, (wxWindow *)win);
+        gs_windowHandles[hWnd] = (wxWindow *)win;
     }
 }
 
 void wxRemoveHandleAssociation(wxWindowMSW *win)
 {
-    wxWinHandleHash->Delete((long)win->GetHWND());
+    gs_windowHandles.erase(GetHwndOf(win));
 }
 
 // ----------------------------------------------------------------------------
Index: src/msw/app.cpp
===================================================================
--- src/msw/app.cpp	(revisione 63679)
+++ src/msw/app.cpp	(copia locale)
@@ -321,8 +321,6 @@
 
     RegisterWindowClasses();
 
-    wxWinHandleHash = new wxWinHashTable(wxKEY_INTEGER, 100);
-
 #if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
     wxSetKeyboardHook(true);
 #endif
@@ -494,9 +492,6 @@
     // unregister the classes now
     UnregisterWindowClasses();
 
-    delete wxWinHandleHash;
-    wxWinHandleHash = NULL;
-
 #ifdef __WXWINCE__
     free( wxCanvasClassName );
     free( wxCanvasClassNameNR );