]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed a bunch of leaking references in how the callbacks deal with
authorRobin Dunn <robin@alldunn.com>
Sun, 10 Dec 2000 08:37:52 +0000 (08:37 +0000)
committerRobin Dunn <robin@alldunn.com>
Sun, 10 Dec 2000 08:37:52 +0000 (08:37 +0000)
objects.  Should be MUCH better now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8887 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

32 files changed:
wxPython/CHANGES.txt
wxPython/b.bat
wxPython/contrib/glcanvas/msw/glcanvas.cpp
wxPython/contrib/ogl/ogl.cpp
wxPython/contrib/ogl/oglbasic.cpp
wxPython/contrib/ogl/oglcanvas.cpp
wxPython/contrib/ogl/oglshapes.cpp
wxPython/contrib/ogl/oglshapes2.cpp
wxPython/contrib/stc/stc_.cpp
wxPython/demo/MDIDemo.py
wxPython/demo/MDISashDemo.py [new file with mode: 0644]
wxPython/demo/wxSashWindow.py
wxPython/demo/wxToolBar.py
wxPython/setup.py
wxPython/src/__version__.py
wxPython/src/filesys.i
wxPython/src/gdi.i
wxPython/src/grid.i
wxPython/src/helpers.cpp
wxPython/src/helpers.h
wxPython/src/html.i
wxPython/src/misc.i
wxPython/src/msw/.cvsignore
wxPython/src/msw/filesys.cpp
wxPython/src/msw/grid.cpp
wxPython/src/msw/html.cpp
wxPython/src/msw/htmlhelp.cpp
wxPython/src/msw/misc.cpp
wxPython/src/msw/streams.cpp
wxPython/src/my_typemaps.i
wxPython/src/streams.i
wxPython/src/wx.i

index 2bf2d6488dae6a603be9a3f46e388a7fa4b5d5fc..22775ca5c63629529bc8e16a4942ba524cdffc63 100644 (file)
@@ -31,6 +31,8 @@ object, (usually a window.)
 
 Added wxNotifyEvent.Allow()
 
+Fixed GOBS of reference leaks.
+
 
 
 New in 2.2.2
index 8be8fa0f71d86488c1ebbe4b2e7642746cfa3b2d..a9d1dae158ef23779c813b0e4efdbab4dc9a6b2a 100755 (executable)
@@ -40,9 +40,14 @@ elseiff "%1" == "f" then
        shift
        set CMD=%SETUP% %FLAGS% FINAL=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
 
+rem "h" --> HYBRID
+elseiff "%1" == "h" then
+       shift
+       set CMD=%SETUP% %FLAGS% HYBRID=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
+
 rem (no command arg) --> normal build for development
 else
-       set CMD=%SETUP% %FLAGS% HYBRID=1 build_ext --inplace %1 %2 %3 %4 %5 %6 %7 %8 %9
+       set CMD=%SETUP% %FLAGS% HYBRID=0 build_ext --inplace --debug %1 %2 %3 %4 %5 %6 %7 %8 %9
 endiff
 
 
index 31f8a86cb2f8b5cfdc3ea77a8f90fe0e3b43d0e4..d1d8ab9a5d74ae436f08e4b6fab19929f2735c6e 100644 (file)
@@ -855,6 +855,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_wxClientDC","_class_wxClientDC",0},
     { "_wxMouseEvent","_class_wxMouseEvent",0},
@@ -1037,6 +1038,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxGauge","_class_wxGauge",0},
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index c40f9ffa53488549067056e52ba5732f7da2338a..270c39eeafd921233ce52938bf18f7d6b44ec28d 100644 (file)
@@ -473,6 +473,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_class_wxPyCircleShape","_wxPyCircleShape",0},
     { "_wxClientDC","_class_wxClientDC",0},
@@ -661,6 +662,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxGauge","_class_wxGauge",0},
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index 5d7a34e06b3579ddb31946171ef82d91112f0bdb..738ad5c3713801c29d2edee0778c82b164e69d01 100644 (file)
@@ -8658,6 +8658,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_wxClientDC","_class_wxClientDC",0},
     { "_wxMouseEvent","_class_wxMouseEvent",0},
@@ -8838,6 +8839,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxGauge","_class_wxGauge",0},
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index a7feb2adec229ff736afea85950bc23dd887bb04..f94961a228606dc6b7e26a322b82f5aff06ff497 100644 (file)
@@ -2305,6 +2305,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_wxClientDC","_class_wxClientDC",0},
     { "_wxMouseEvent","_class_wxMouseEvent",0},
@@ -2488,6 +2489,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxGauge","_class_wxGauge",0},
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index 8e50c3b27519046abf293e718b44f759dafeb583..eb4ef6b76bb7df049469af0ab14283e462db9981 100644 (file)
@@ -12875,6 +12875,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_wxClientDC","_class_wxClientDC",0},
     { "_wxMouseEvent","_class_wxMouseEvent",0},
@@ -13087,6 +13088,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxGauge","_class_wxGauge",0},
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index 5f31bd4ca9b00700d841ba72d203e5af4349ba0b..24aaae0bb7262055cd566d349d833f3ba5316404 100644 (file)
@@ -8215,6 +8215,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_class_wxPyCircleShape","_wxPyCircleShape",0},
     { "_wxClientDC","_class_wxClientDC",0},
@@ -8422,6 +8423,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxGauge","_class_wxGauge",0},
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index 23d65b1325176bfd9d945faebeb536bd349f0f65..0dc14d65e5dea989af13b11bbbf6e95302fad77a 100644 (file)
@@ -8823,6 +8823,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_wxClientDC","_class_wxClientDC",0},
     { "_wxMouseEvent","_class_wxMouseEvent",0},
@@ -9006,6 +9007,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxGauge","_class_wxGauge",0},
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_class_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent},
     { "_class_wxCommandEvent","_wxStyledTextEvent",SwigwxStyledTextEventTowxCommandEvent},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
index 0e3b0ecad5e2ed2fb095430f28d47fd66e983be4..6251ec4a41b5cb4dad84e9f0b4e3678d6585d12e 100644 (file)
@@ -19,7 +19,7 @@ class MyParentFrame(wxMDIParentFrame):
         menubar.Append(menu, "&File")
         self.SetMenuBar(menubar)
 
-        #self.CreateStatusBar()
+        self.CreateStatusBar()
 
         EVT_MENU(self, 5000, self.OnNewWindow)
         EVT_MENU(self, 5001, self.OnExit)
diff --git a/wxPython/demo/MDISashDemo.py b/wxPython/demo/MDISashDemo.py
new file mode 100644 (file)
index 0000000..2e4258f
--- /dev/null
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+
+from wxPython.wx import *
+from wxScrolledWindow import MyCanvas
+
+#----------------------------------------------------------------------
+
+class MyParentFrame(wxMDIParentFrame):
+    ID_WINDOW_TOP    = 5100
+    ID_WINDOW_LEFT1  = 5101
+    ID_WINDOW_LEFT2  = 5102
+    ID_WINDOW_BOTTOM = 5103
+
+    def __init__(self):
+        wxMDIParentFrame.__init__(self, None, -1, "MDI Parent", size=(600,400),
+                                  style = wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL)
+
+        self.winCount = 0
+        menu = wxMenu()
+        menu.Append(5000, "&New Window")
+        menu.AppendSeparator()
+        menu.Append(5001, "E&xit")
+
+        menubar = wxMenuBar()
+        menubar.Append(menu, "&File")
+        self.SetMenuBar(menubar)
+
+        #self.CreateStatusBar()
+
+        EVT_MENU(self, 5000, self.OnNewWindow)
+        EVT_MENU(self, 5001, self.OnExit)
+
+
+        EVT_SASH_DRAGGED_RANGE(self,
+                               self.ID_WINDOW_TOP, self.ID_WINDOW_BOTTOM,
+                               self.OnSashDrag)
+        EVT_SIZE(self, self.OnSize)
+
+
+        # Create some layout windows
+        # A window like a toolbar
+        win = wxSashLayoutWindow(self, self.ID_WINDOW_TOP, style = wxNO_BORDER|wxSW_3D)
+        win.SetDefaultSize((1000, 30))
+        win.SetOrientation(wxLAYOUT_HORIZONTAL)
+        win.SetAlignment(wxLAYOUT_TOP)
+        win.SetBackgroundColour(wxColour(255, 0, 0))
+        win.SetSashVisible(wxSASH_BOTTOM, true)
+
+        self.topWindow = win
+
+
+        # A window like a statusbar
+        win = wxSashLayoutWindow(self, self.ID_WINDOW_BOTTOM, style = wxNO_BORDER|wxSW_3D)
+        win.SetDefaultSize((1000, 30))
+        win.SetOrientation(wxLAYOUT_HORIZONTAL)
+        win.SetAlignment(wxLAYOUT_BOTTOM)
+        win.SetBackgroundColour(wxColour(0, 0, 255))
+        win.SetSashVisible(wxSASH_TOP, true)
+
+        self.bottomWindow = win
+
+
+        # A window to the left of the client window
+        win =  wxSashLayoutWindow(self, self.ID_WINDOW_LEFT1, style = wxNO_BORDER|wxSW_3D)
+        win.SetDefaultSize((120, 1000))
+        win.SetOrientation(wxLAYOUT_VERTICAL)
+        win.SetAlignment(wxLAYOUT_LEFT)
+        win.SetBackgroundColour(wxColour(0, 255, 0))
+        win.SetSashVisible(wxSASH_RIGHT, TRUE)
+        win.SetExtraBorderSize(10)
+        textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
+                                wxTE_MULTILINE|wxSUNKEN_BORDER)
+        textWindow.SetValue("A sub window")
+
+        self.leftWindow1 = win
+
+
+        # Another window to the left of the client window
+        win = wxSashLayoutWindow(self, self.ID_WINDOW_LEFT2, style = wxNO_BORDER|wxSW_3D)
+        win.SetDefaultSize((120, 1000))
+        win.SetOrientation(wxLAYOUT_VERTICAL)
+        win.SetAlignment(wxLAYOUT_LEFT)
+        win.SetBackgroundColour(wxColour(0, 255, 255))
+        win.SetSashVisible(wxSASH_RIGHT, TRUE)
+
+        self.leftWindow2 = win
+
+
+    def OnSashDrag(self, event):
+        if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE:
+            return
+
+        eID = event.GetId()
+        if eID == self.ID_WINDOW_TOP:
+            self.topWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
+
+        elif eID == self.ID_WINDOW_LEFT1:
+            self.leftWindow1.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
+
+
+        elif eID == self.ID_WINDOW_LEFT2:
+            self.leftWindow2.SetDefaultSize(wxSize(event.GetDragRect().width, 1000))
+
+        elif eID == self.ID_WINDOW_BOTTOM:
+            self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
+
+        wxLayoutAlgorithm().LayoutMDIFrame(self)
+        self.GetClientWindow().Refresh()
+
+
+    def OnSize(self, event):
+        wxLayoutAlgorithm().LayoutMDIFrame(self)
+
+
+    def OnExit(self, evt):
+        self.Close(true)
+
+
+    def OnNewWindow(self, evt):
+        self.winCount = self.winCount + 1
+        win = wxMDIChildFrame(self, -1, "Child Window: %d" % self.winCount)
+        canvas = MyCanvas(win)
+        win.Show(true)
+
+
+#----------------------------------------------------------------------
+
+class MyApp(wxApp):
+    def OnInit(self):
+        frame = MyParentFrame()
+        frame.Show(true)
+        self.SetTopWindow(frame)
+        return true
+
+
+app = MyApp(0)
+app.MainLoop()
+
+
+
index 93b8b984177085afc3b1d8171157361607bdf9d4..620427eaeba1a9854ab2205beefddfeb03954ae3 100644 (file)
@@ -15,6 +15,9 @@ class TestSashWindow(wxPanel):
 
         self.log = log
 
+        # will accupy the space not uised by the Layout Algorithm
+        self.remainingSpace = wxPanel(self, -1, style=wxSUNKEN_BORDER)
+
         EVT_SASH_DRAGGED_RANGE(self, self.ID_WINDOW_TOP,
                                self.ID_WINDOW_BOTTOM, self.OnSashDrag)
         EVT_SIZE(self, self.OnSize)
@@ -56,10 +59,9 @@ class TestSashWindow(wxPanel):
         win.SetBackgroundColour(wxColour(0, 255, 0))
         win.SetSashVisible(wxSASH_RIGHT, TRUE)
         win.SetExtraBorderSize(10)
-
         textWindow = wxTextCtrl(win, -1, "", wxDefaultPosition, wxDefaultSize,
                                 wxTE_MULTILINE|wxSUNKEN_BORDER)
-        textWindow.SetValue("A help window")
+        textWindow.SetValue("A sub window")
 
         self.leftWindow1 = win
 
@@ -95,11 +97,11 @@ class TestSashWindow(wxPanel):
         elif eID == self.ID_WINDOW_BOTTOM:
             self.bottomWindow.SetDefaultSize(wxSize(1000, event.GetDragRect().height))
 
-        wxLayoutAlgorithm().LayoutWindow(self)
-
+        wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
+        self.remainingSpace.Refresh()
 
     def OnSize(self, event):
-        wxLayoutAlgorithm().LayoutWindow(self)
+        wxLayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
 
 #---------------------------------------------------------------------------
 
@@ -125,29 +127,4 @@ def runTest(frame, nb, log):
 
 
 overview = """\
-wxSashLayoutWindow responds to OnCalculateLayout events generated by wxLayoutAlgorithm. It allows the application to use simple accessors to specify how the window should be laid out, rather than having to respond to events. The fact that the class derives from wxSashWindow allows sashes to be used if required, to allow the windows to be user-resizable.
-
-wxSashLayoutWindow()
--------------------------------------------
-
-Default constructor.
-
-wxSashLayoutWindow(wxSashLayoutWindow* parent, wxSashLayoutWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLIP_CHILDREN | wxSW_3D, const wxString& name = "layoutWindow")
-
-Constructs a sash layout window, which can be a child of a frame, dialog or any other non-control window.
-
-Parameters
--------------------
-
-parent = Pointer to a parent window.
-
-id = Window identifier. If -1, will automatically create an identifier.
-
-pos = Window position. wxDefaultPosition is (-1, -1) which indicates that wxSashLayoutWindows should generate a default position for the window. If using the wxSashLayoutWindow class directly, supply an actual position.
-
-size = Window size. wxDefaultSize is (-1, -1) which indicates that wxSashLayoutWindows should generate a default size for the window.
-
-style = Window style. For window styles, please see wxSashLayoutWindow.
-
-name = Window name.
 """
index bea5f1336f3951172177664994528e55466c0be6..4a4df1b506c5d59cf99ac66e1ca5bc572628a295 100644 (file)
@@ -78,7 +78,7 @@ class TestToolBar(wxFrame):
         event.Skip()
 
 
-    def OnClearSB(self, event):
+    def OnClearSB(self, event):  # called for the timer event handler
         self.SetStatusText("")
         self.timer.Stop()
         self.timer = None
index ba00793af8543ad90acc8bce3976f65d47728e85..f440d5e3d345f25f477a041c5b621f8a56dce085 100755 (executable)
@@ -13,7 +13,7 @@ from my_distutils import run_swig, contrib_copy_tree
 # flags and values that affect this script
 #----------------------------------------------------------------------
 
-VERSION          = "2.3.0b1"
+VERSION          = "2.3b1"
 DESCRIPTION      = "Cross platform GUI toolkit for Python"
 AUTHOR           = "Robin Dunn"
 AUTHOR_EMAIL     = "robin@alldunn.com"
@@ -199,7 +199,7 @@ if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'):
 
 print 'Preparing CORE...'
 swig_force = force
-swig_args = ['-c++', '-shadow', '-python', '-keyword', '-dascii',
+swig_args = ['-c++', '-shadow', '-python', '-keyword', '-dnone', #'-dascii',
              '-I./src', '-D'+WXPLAT]
 swig_deps = ['src/my_typemaps.i']
 
index 8d9b0a60d8b6964ec7e55a0785b3115c20daf0c4..d814eaf09c2028e58c68ce530932a88e5029074f 100644 (file)
@@ -1 +1 @@
-ver = '2.3.0b1'
+ver = '2.3b1'
index 7fc6c420c60a2eb01455e534606967c0d72a2966..99df7c6049c66853198cb6fe495ef057d86526d8 100644 (file)
@@ -75,7 +75,9 @@
 //              Py_DECREF(arg);
 
 //              // set ThisOwn
-//              PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
+//              PyObject* one = PyInt_FromLong(1);
+//              PyObject_SetAttrString($target, "thisown", one);
+//              Py_DECREF(one);
 //          }
 //      } else {
 //          Py_INCREF(Py_None);
index 319d1000def4fcdbe360b4268bba81f2c7b2f80f..63e628e81ee18901ebc5ca8cf661976430f44224 100644 (file)
@@ -339,6 +339,7 @@ public:
 };
 
 %new wxColour* wxNamedColour(const wxString& colorName);
+
 %{                                      // Alternate 'constructor'
     wxColour* wxNamedColour(const wxString& colorName) {
         return new wxColour(colorName);
index 1fa8187e596aacb7dc40a7f42d274eaa564cbb94..5e0971123d82239465512a21ee0f8140aa07f9da 100644 (file)
 #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME)                           \
     void CBNAME(wxGridCellAttr *attr, int a, int b) {                   \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            m_myInst.callCallback(                                      \
-                Py_BuildValue("(Oii)",                                  \
-                              wxPyConstructObject((void*)attr, "wxGridCellAttr"),    \
-                              a, b));                                   \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+            m_myInst.callCallback(Py_BuildValue("(Oii)", obj, a, b));   \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             PCLASS::CBNAME(attr, a, b);                                 \
         wxPySaveThread(doSave);                                         \
 #define PYCALLBACK__GCAINT(PCLASS, CBNAME)                              \
     void CBNAME(wxGridCellAttr *attr, int val) {                        \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            m_myInst.callCallback(                                      \
-                Py_BuildValue("(Oi)",                                   \
-                              wxPyConstructObject((void*)attr, "wxGridCellAttr"),    \
-                              val));                                    \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+            m_myInst.callCallback(Py_BuildValue("(Oi)", obj, val));     \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             PCLASS::CBNAME(attr, val);                                  \
         wxPySaveThread(doSave);                                         \
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b));   \
             if (ro) {                                                   \
-                rval = PyString_AsString(PyObject_Str(ro));             \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyString_AsString(str);                          \
+                Py_DECREF(ro);  Py_DECREF(str);                         \
             }                                                           \
         }                                                               \
         wxPySaveThread(doSave);                                         \
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b));   \
             if (ro) {                                                   \
-                rval = PyString_AsString(PyObject_Str(ro));             \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyString_AsString(str);                          \
+                Py_DECREF(ro);  Py_DECREF(str);                         \
             }                                                           \
         } else                                                          \
             rval = PCLASS::CBNAME(a, b);                                \
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b));   \
             if (ro) {                                                   \
-                rval = PyFloat_AsDouble(PyObject_Str(ro));              \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyFloat_AsDouble(str);                           \
+                Py_DECREF(ro);   Py_DECREF(str);                        \
             }                                                           \
         } else                                                          \
             rval = PCLASS::CBNAME(a, b);                                \
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a));      \
             if (ro) {                                                   \
-                rval = PyString_AsString(PyObject_Str(ro));             \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyString_AsString(str);                          \
+                Py_DECREF(ro);   Py_DECREF(str);                        \
             }                                                           \
         } else                                                          \
             rval = PCLASS::CBNAME(a);                                   \
@@ -982,7 +986,6 @@ public:
     PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
 
 
-
     wxString GetValue(int row, int col) {
         bool doSave = wxPyRestoreThread();
         wxString rval;
@@ -990,8 +993,10 @@ public:
             PyObject* ro;
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col));
             if (ro) {
-                rval = PyString_AsString(PyObject_Str(ro));
+                PyObject* str = PyObject_Str(ro);
+                rval = PyString_AsString(str);
                 Py_DECREF(ro);
+                Py_DECREF(str);
             }
         }
         wxPySaveThread(doSave);
index b59f95f5fe6736cb431b99fa561ca8e865b1a935..4495879274c95ffd9e6a9a5036046aead26d5875 100644 (file)
@@ -105,6 +105,11 @@ int  wxPyApp::MainLoop(void) {
 //---------------------------------------------------------------------
 //----------------------------------------------------------------------
 
+#ifdef __WXMSW__
+#include "wx/msw/msvcrt.h"
+#endif
+
+
 int  WXDLLEXPORT wxEntryStart( int argc, char** argv );
 int  WXDLLEXPORT wxEntryInitGui();
 void WXDLLEXPORT wxEntryCleanup();
@@ -121,6 +126,11 @@ static char* __nullArgv[1] = { 0 };
 // wxcmodule is imported.  (Before there is a wxApp object.)
 void __wxPreStart()
 {
+
+#ifdef __WXMSW__
+//    wxCrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
+#endif
+
 #ifdef WXP_WITH_THREAD
     PyEval_InitThreads();
     wxPyEventThreadState = PyThreadState_Get();
@@ -158,11 +168,12 @@ PyObject* __wxStart(PyObject* /* self */, PyObject* args)
     if (!PyArg_ParseTuple(args, "O", &onInitFunc))
         return NULL;
 
+#if 0  // Try it out without this check, soo how it does...
     if (wxTopLevelWindows.Number() > 0) {
         PyErr_SetString(PyExc_TypeError, "Only 1 wxApp per process!");
         return NULL;
     }
-
+#endif
 
     // This is the next part of the wxEntry functionality...
     PyObject* sysargv = PySys_GetObject("argv");
@@ -280,7 +291,9 @@ PyObject* wxPyConstructObject(void* ptr,
     Py_DECREF(arg);
 
     if (setThisOwn) {
-        PyObject_SetAttrString(obj, "thisown", PyInt_FromLong(1));
+        PyObject* one = PyInt_FromLong(1);
+        PyObject_SetAttrString(obj, "thisown", one);
+        Py_DECREF(one);
     }
 
     return obj;
@@ -427,12 +440,12 @@ void wxPyCallbackHelper::setSelf(PyObject* self, PyObject* klass, int incref) {
 // If the object (m_self) has an attibute of the given name, and if that
 // attribute is a method, and if that method's class is not from a base class,
 // then we'll save a pointer to the method so callCallback can call it.
-bool wxPyCallbackHelper::findCallback(const wxString& name) const {
+bool wxPyCallbackHelper::findCallback(const char* name) const {
     wxPyCallbackHelper* self = (wxPyCallbackHelper*)this; // cast away const
     self->m_lastFound = NULL;
-    if (m_self && PyObject_HasAttrString(m_self, (char*)name.c_str())) {
+    if (m_self && PyObject_HasAttrString(m_self, (char*)name)) {
         PyObject* method;
-        method = PyObject_GetAttrString(m_self, (char*)name.c_str());
+        method = PyObject_GetAttrString(m_self, (char*)name);
 
         if (PyMethod_Check(method) &&
             ((PyMethod_GET_CLASS(method) == m_class) ||
@@ -440,6 +453,9 @@ bool wxPyCallbackHelper::findCallback(const wxString& name) const {
 
             self->m_lastFound = method;
         }
+        else {
+            Py_DECREF(method);
+        }
     }
     return m_lastFound != NULL;
 }
@@ -461,10 +477,17 @@ int wxPyCallbackHelper::callCallback(PyObject* argTuple) const {
 // Invoke the Python callable object, returning the raw PyObject return
 // value.  Caller should DECREF the return value and also call PyEval_SaveThread.
 PyObject* wxPyCallbackHelper::callCallbackObj(PyObject* argTuple) const {
-    PyObject*   result;
+    wxPyCallbackHelper* self = (wxPyCallbackHelper*)this; // cast away const
+    PyObject* result;
 
-    result = PyEval_CallObject(m_lastFound, argTuple);
+    // Save a copy of the pointer in case the callback generates another
+    // callback.  In that case m_lastFound will have a different value when
+    // it gets back here...
+    PyObject* method = m_lastFound;
+
+    result = PyEval_CallObject(method, argTuple);
     Py_DECREF(argTuple);
+    Py_DECREF(method);
     if (!result) {
         PyErr_Print();
     }
@@ -987,7 +1010,7 @@ bool wxColour_helper(PyObject* source, wxColour** obj) {
     }
 
  error:
-    PyErr_SetString(PyExc_TypeError, "Expected a wxColour object or a string containing a colour name or #RRGGBB.");
+    PyErr_SetString(PyExc_TypeError, "Expected a wxColour object or a string containing a colour name or '#RRGGBB'.");
     return FALSE;
 }
 
@@ -998,3 +1021,4 @@ bool wxColour_helper(PyObject* source, wxColour** obj) {
 
 
 
+
index dcc6fb1aea2380a956e4279e004287e877015993..63f9c255a2a63feec882a898a9425afd5be6542c 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <wx/wx.h>
 
-
 //----------------------------------------------------------------------
 
 // if we want to handle threads and Python threads are available...
@@ -216,7 +215,7 @@ public:
 
     void        setSelf(PyObject* self, PyObject* klass, int incref=TRUE);
 
-    bool        findCallback(const wxString& name) const;
+    bool        findCallback(const char* name) const;
     int         callCallback(PyObject* argTuple) const;
     PyObject*   callCallbackObj(PyObject* argTuple) const;
 
@@ -393,9 +392,11 @@ public:
 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME)               \
     void CLASS::CBNAME(wxDC& a) {                               \
         bool doSave = wxPyRestoreThread();                      \
-        if (m_myInst.findCallback(#CBNAME))                     \
-            m_myInst.callCallback(Py_BuildValue("(O)",          \
-                            wxPyConstructObject(&a, "wxDC")));  \
+        if (m_myInst.findCallback(#CBNAME)) {                   \
+            PyObject* obj = wxPyConstructObject(&a, "wxDC");    \
+            m_myInst.callCallback(Py_BuildValue("(O)", obj));   \
+            Py_DECREF(obj);                                     \
+        }                                                       \
         else                                                    \
             PCLASS::CBNAME(a);                                  \
         wxPySaveThread(doSave);                                 \
@@ -416,9 +417,11 @@ public:
 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME)                   \
     void CLASS::CBNAME(wxDC& a, bool b) {                               \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            m_myInst.callCallback(Py_BuildValue("(Oi)",                 \
-                            wxPyConstructObject(&a, "wxDC"), (int)b));  \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject(&a, "wxDC");            \
+            m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b));  \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             PCLASS::CBNAME(a, b);                                       \
         wxPySaveThread(doSave);                                         \
@@ -437,9 +440,11 @@ public:
 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME)                   \
     void CLASS::CBNAME(wxDC& a, bool b) {                               \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            m_myInst.callCallback(Py_BuildValue("(Oi)",                 \
-                            wxPyConstructObject(&a, "wxDC"), (int)b));  \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject(&a, "wxDC");            \
+            m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b));  \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             PCLASS::CBNAME(a, b);                                       \
                 wxPySaveThread(doSave);                                 \
@@ -499,10 +504,11 @@ public:
 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME)                               \
     void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {       \
         bool doSave = wxPyRestoreThread();                                              \
-        if (m_myInst.findCallback(#CBNAME))                                             \
-            m_myInst.callCallback(Py_BuildValue("(Oddddi)",                             \
-                                   wxPyConstructObject(&a, "wxDC"),                     \
-                                              b, c, d, e, (int)f));                     \
+        if (m_myInst.findCallback(#CBNAME)) {                                           \
+            PyObject* obj = wxPyConstructObject(&a, "wxDC");                            \
+            m_myInst.callCallback(Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));  \
+            Py_DECREF(obj);                                                             \
+        }                                                                               \
         else                                                                            \
             PCLASS::CBNAME(a, b, c, d, e, f);                                           \
         wxPySaveThread(doSave);                                                         \
@@ -522,10 +528,11 @@ public:
     bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {       \
         bool doSave = wxPyRestoreThread();                                              \
         bool rval;                                                                      \
-        if (m_myInst.findCallback(#CBNAME))                                             \
-            rval = m_myInst.callCallback(Py_BuildValue("(Oddddi)",                      \
-                                   wxPyConstructObject(&a, "wxDC"),                     \
-                                              b, c, d, e, (int)f));                     \
+        if (m_myInst.findCallback(#CBNAME)) {                                           \
+            PyObject* obj = wxPyConstructObject(&a, "wxDC");                            \
+            rval = m_myInst.callCallback(Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
+            Py_DECREF(obj);                                                             \
+        }                                                                               \
         else                                                                            \
             rval = PCLASS::CBNAME(a, b, c, d, e, f);                                    \
         wxPySaveThread(doSave);                                                         \
@@ -566,10 +573,11 @@ public:
 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME)                           \
     void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) {       \
         bool doSave = wxPyRestoreThread();                                      \
-        if (m_myInst.findCallback(#CBNAME))                                     \
-            m_myInst.callCallback(Py_BuildValue("(Odddd)",                      \
-                                   wxPyConstructObject(&a, "wxDC"),             \
-                                                     b, c, d, e));              \
+        if (m_myInst.findCallback(#CBNAME)) {                                   \
+            PyObject* obj = wxPyConstructObject(&a, "wxDC");                    \
+            m_myInst.callCallback(Py_BuildValue("(Odddd)", obj, b, c, d, e));   \
+            Py_DECREF(obj);                                                     \
+        }                                                                       \
         else                                                                    \
             PCLASS::CBNAME(a, b, c, d, e);                                      \
         wxPySaveThread(doSave);                                                 \
@@ -588,10 +596,11 @@ public:
 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME)                   \
     void CLASS::CBNAME(wxDC& a, bool b) {                               \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            m_myInst.callCallback(Py_BuildValue("(Oi)",                 \
-                                   wxPyConstructObject(&a, "wxDC"),     \
-                                                     (int)b));          \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject(&a, "wxDC");            \
+            m_myInst.callCallback(Py_BuildValue("(Oi)", obj, (int)b));  \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             PCLASS::CBNAME(a, b);                                       \
         wxPySaveThread(doSave);                                         \
@@ -611,10 +620,11 @@ public:
     void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d,           \
                 int e, int f) {                                                 \
         bool doSave = wxPyRestoreThread();                                      \
-        if (m_myInst.findCallback(#CBNAME))                                     \
-            m_myInst.callCallback(Py_BuildValue("(Oiddii)",                     \
-                                 wxPyConstructObject(a, "wxPyControlPoint"),    \
-                                 (int)b, c, d, e, f));                          \
+        if (m_myInst.findCallback(#CBNAME)) {                                   \
+            PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint");         \
+            m_myInst.callCallback(Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
+            Py_DECREF(obj);                                                     \
+        }                                                                       \
         else                                                                    \
             PCLASS::CBNAME(a, b, c, d, e, f);                                   \
         wxPySaveThread(doSave);                                                 \
@@ -634,10 +644,11 @@ public:
 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME)                     \
     void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) {   \
         bool doSave = wxPyRestoreThread();                                      \
-        if (m_myInst.findCallback(#CBNAME))                                     \
-            m_myInst.callCallback(Py_BuildValue("(Oddii)",                      \
-                                 wxPyConstructObject(a, "wxPyControlPoint"),    \
-                                 b, c, d, e));                                  \
+        if (m_myInst.findCallback(#CBNAME)) {                                   \
+            PyObject* obj = wxPyConstructObject(a, "wxPyControlPoint");         \
+            m_myInst.callCallback(Py_BuildValue("(Oddii)", obj, b, c, d, e));   \
+            Py_DECREF(obj);                                                     \
+        }                                                                       \
         else                                                                    \
             PCLASS::CBNAME(a, b, c, d, e);                                      \
         wxPySaveThread(doSave);                                                 \
@@ -758,8 +769,9 @@ public:
             PyObject* ro;                                                       \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(s)", a.c_str()));     \
             if (ro) {                                                           \
-                rval = PyString_AsString(PyObject_Str(ro));                     \
-                Py_DECREF(ro);                                                  \
+                PyObject* str = PyObject_Str(ro);                               \
+                rval = PyString_AsString(str);                                  \
+                Py_DECREF(ro);   Py_DECREF(str);                                \
             }                                                                   \
         }                                                                       \
         wxPySaveThread(doSave);                                                 \
@@ -779,8 +791,9 @@ public:
             PyObject* ro;                                                       \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(si)", a.c_str(),b));  \
             if (ro) {                                                           \
-                rval = PyString_AsString(PyObject_Str(ro));                     \
-                Py_DECREF(ro);                                                  \
+                PyObject* str = PyObject_Str(ro);                               \
+                rval = PyString_AsString(str);                                  \
+                Py_DECREF(ro);   Py_DECREF(str);                                \
             }                                                                   \
         }                                                                       \
         wxPySaveThread(doSave);                                                 \
@@ -825,8 +838,9 @@ public:
             PyObject* ro;                                                       \
             ro = m_myInst.callCallbackObj(Py_BuildValue("()"));                 \
             if (ro) {                                                           \
-                rval = PyString_AsString(PyObject_Str(ro));                     \
-                Py_DECREF(ro);                                                  \
+                PyObject* str = PyObject_Str(ro);                               \
+                rval = PyString_AsString(str);                                  \
+                Py_DECREF(ro);  Py_DECREF(str);                                 \
             }                                                                   \
         }                                                                       \
         else                                                                    \
@@ -852,8 +866,9 @@ public:
             PyObject* ro;                                                       \
             ro = m_myInst.callCallbackObj(Py_BuildValue("()"));                 \
             if (ro) {                                                           \
-                rval = PyString_AsString(PyObject_Str(ro));                     \
-                Py_DECREF(ro);                                                  \
+                PyObject* str = PyObject_Str(ro);                               \
+                rval = PyString_AsString(str);                                  \
+                Py_DECREF(ro);   Py_DECREF(str);                                \
             }                                                                   \
         }                                                                       \
         wxPySaveThread(doSave);                                                 \
@@ -870,9 +885,11 @@ public:
     bool CLASS::CBNAME(const wxHtmlTag& a)  {                                   \
         bool rval = FALSE;                                                      \
         bool doSave = wxPyRestoreThread();                                      \
-        if (m_myInst.findCallback(#CBNAME))                                     \
-            rval = m_myInst.callCallback(Py_BuildValue("(O)",                   \
-                                         wxPyConstructObject((void*)&a,"wxHtmlTag"))); \
+        if (m_myInst.findCallback(#CBNAME)) {                                   \
+            PyObject* obj = wxPyConstructObject((void*)&a,"wxHtmlTag");         \
+            rval = m_myInst.callCallback(Py_BuildValue("(O)", obj));            \
+            Py_DECREF(obj);                                                     \
+        }                                                                       \
         wxPySaveThread(doSave);                                                 \
         return rval;                                                            \
     }
@@ -926,9 +943,11 @@ public:
     bool CLASS::CBNAME(wxWindow* a) {                                   \
         bool rval;                                                      \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            rval = m_myInst.callCallback(Py_BuildValue("(O)",           \
-                            wxPyConstructObject((void*)a,"wxWindow"))); \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)a,"wxWindow");   \
+            rval = m_myInst.callCallback(Py_BuildValue("(O)", obj));    \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             rval = PCLASS::CBNAME(a);                                   \
         wxPySaveThread(doSave);                                         \
@@ -993,13 +1012,15 @@ public:
         wxFSFile* rval=0;                                               \
         if (m_myInst.findCallback(#CBNAME)) {                           \
             PyObject* ro;                                               \
-            ro=m_myInst.callCallbackObj(Py_BuildValue("(Os)",           \
-            wxPyConstructObject(&a, "(wxFileSystemC"),b.c_str()));      \
+            PyObject* obj = wxPyConstructObject(&a, "(wxFileSystem");   \
+            ro = m_myInst.callCallbackObj(Py_BuildValue("(Os)",         \
+                                          obj, b.c_str()));             \
             if (ro) {                                                   \
                 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p");      \
                 Py_DECREF(ro);                                          \
             }                                                           \
-      }                                                                 \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         wxPySaveThread(doSave);                                         \
         return rval;                                                    \
     };
@@ -1117,18 +1138,20 @@ public:
     void base_##CBNAME(const Type& a);
 
 
-#define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type)   \
-    void CLASS::CBNAME(const Type& a) {                         \
-        bool doSave = wxPyRestoreThread();                      \
-        if (m_myInst.findCallback(#CBNAME))                     \
-            m_myInst.callCallback(Py_BuildValue("(O)",          \
-                     wxPyConstructObject((void*)&a, #Type)));   \
-        else                                                    \
-            PCLASS::CBNAME(a);                                  \
-        wxPySaveThread(doSave);                                 \
-    }                                                           \
-    void CLASS::base_##CBNAME(const Type& a) {                  \
-        PCLASS::CBNAME(a);                                      \
+#define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type)           \
+    void CLASS::CBNAME(const Type& a) {                                 \
+        bool doSave = wxPyRestoreThread();                              \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)&a, #Type);      \
+            m_myInst.callCallback(Py_BuildValue("(O)", obj));           \
+            Py_DECREF(obj);                                             \
+        }                                                               \
+        else                                                            \
+            PCLASS::CBNAME(a);                                          \
+        wxPySaveThread(doSave);                                         \
+    }                                                                   \
+    void CLASS::base_##CBNAME(const Type& a) {                          \
+        PCLASS::CBNAME(a);                                              \
     }
 
 
@@ -1139,18 +1162,20 @@ public:
     void base_##CBNAME(Type& a);
 
 
-#define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type)        \
-    void CLASS::CBNAME(Type& a) {                               \
-        bool doSave = wxPyRestoreThread();                      \
-        if (m_myInst.findCallback(#CBNAME))                     \
-            m_myInst.callCallback(Py_BuildValue("(O)",          \
-                            wxPyConstructObject(&a, #Type)));   \
-        else                                                    \
-            PCLASS::CBNAME(a);                                  \
-        wxPySaveThread(doSave);                                 \
-    }                                                           \
-    void CLASS::base_##CBNAME(Type& a) {                        \
-        PCLASS::CBNAME(a);                                      \
+#define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type)                \
+    void CLASS::CBNAME(Type& a) {                                       \
+        bool doSave = wxPyRestoreThread();                              \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)&a, #Type);      \
+            m_myInst.callCallback(Py_BuildValue("(O)", obj));           \
+            Py_DECREF(obj);                                             \
+        }                                                               \
+        else                                                            \
+            PCLASS::CBNAME(a);                                          \
+        wxPySaveThread(doSave);                                         \
+    }                                                                   \
+    void CLASS::base_##CBNAME(Type& a) {                                \
+        PCLASS::CBNAME(a);                                              \
     }
 
 //---------------------------------------------------------------------------
@@ -1160,20 +1185,22 @@ public:
     bool base_##CBNAME(Type& a);
 
 
-#define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type)    \
-    bool CLASS::CBNAME(Type& a) {                               \
-        bool rv;                                                \
-        bool doSave = wxPyRestoreThread();                      \
-        if (m_myInst.findCallback(#CBNAME))                     \
-            rv = m_myInst.callCallback(Py_BuildValue("(O)",     \
-                            wxPyConstructObject(&a, #Type)));   \
-        else                                                    \
-            rv = PCLASS::CBNAME(a);                             \
-        wxPySaveThread(doSave);                                 \
-        return rv;                                              \
-    }                                                           \
-    bool CLASS::base_##CBNAME(Type& a) {                        \
-        return PCLASS::CBNAME(a);                               \
+#define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type)            \
+    bool CLASS::CBNAME(Type& a) {                                       \
+        bool rv;                                                        \
+        bool doSave = wxPyRestoreThread();                              \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)&a, #Type);      \
+            rv = m_myInst.callCallback(Py_BuildValue("(O)", obj));      \
+            Py_DECREF(obj);                                             \
+        }                                                               \
+        else                                                            \
+            rv = PCLASS::CBNAME(a);                                     \
+        wxPySaveThread(doSave);                                         \
+        return rv;                                                      \
+    }                                                                   \
+    bool CLASS::base_##CBNAME(Type& a) {                                \
+        return PCLASS::CBNAME(a);                                       \
     }
 
 //---------------------------------------------------------------------------
index bb4af6d866185282d7d39d1877a71781a730ed40..5ec1deae66f43dd8c0aff498453f5136df2fc9fc 100644 (file)
@@ -275,12 +275,14 @@ public:
     }
 
     void OnExit() {
+        bool doSave = wxPyRestoreThread();
         Py_DECREF(m_tagHandlerClass);
         m_tagHandlerClass = NULL;
         for (size_t x=0; x < m_objArray.GetCount(); x++) {
             PyObject* obj = (PyObject*)m_objArray.Item(x);
             Py_DECREF(obj);
         }
+        wxPySaveThread(doSave);
     };
 
     void FillHandlersTable(wxHtmlWinParser *parser) {
@@ -434,6 +436,7 @@ IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
     if (m_myInst.findCallback("OnLinkClicked")) {
         PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo");
         m_myInst.callCallback(Py_BuildValue("(O)", obj));
+        Py_DECREF(obj);
     }
     else
         wxHtmlWindow::OnLinkClicked(link);
index 94e2143b05b1bd570da1d465b94b194f6a092543..fd0aada052f29c637063a29a40955cdc9a0ac8c5 100644 (file)
@@ -255,7 +255,9 @@ public:
             bool doSave = wxPyRestoreThread();
             wxRect* newRect = new wxRect(dest);
             obj = wxPyConstructObject((void*)newRect, "wxRect");
-            PyObject_SetAttrString(obj, "thisown", PyInt_FromLong(1));
+            PyObject* one = PyInt_FromLong(1);
+            PyObject_SetAttrString(obj, "thisown", one);
+            Py_DECREF(one);
             wxPySaveThread(doSave);
             return obj;
         }
index 5c511172dcc144a75ca9eeb556f3b60828a1b668..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 (file)
@@ -1 +1 @@
-*.doc
+
index 782dc5025196cc9681819021e7558e190f777bac..7bec48995168ae50e0b8b299ee8d999ae2232344 100644 (file)
@@ -488,7 +488,9 @@ static PyObject *_wrap_wxFSFile_GetStream(PyObject *self, PyObject *args, PyObje
             Py_DECREF(arg);
 
             // set ThisOwn
-            PyObject_SetAttrString(_resultobj, "thisown", PyInt_FromLong(1));
+            PyObject* one = PyInt_FromLong(1);
+            PyObject_SetAttrString(_resultobj, "thisown", one);
+            Py_DECREF(one);
         }
     } else {
         Py_INCREF(Py_None);
index 1afeefd444114b1b62a01acaf75d81b1f2a49407..636d9c0c46b2bd29ff9259c73791a6e1e2e9976b 100644 (file)
@@ -134,11 +134,11 @@ static char* wxStringErrorMsg = "string type is required for parameter";
 #define PYCALLBACK__GCAINTINT(PCLASS, CBNAME)                           \
     void CBNAME(wxGridCellAttr *attr, int a, int b) {                   \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            m_myInst.callCallback(                                      \
-                Py_BuildValue("(Oii)",                                  \
-                              wxPyConstructObject((void*)attr, "wxGridCellAttr"),    \
-                              a, b));                                   \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+            m_myInst.callCallback(Py_BuildValue("(Oii)", obj, a, b));   \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             PCLASS::CBNAME(attr, a, b);                                 \
         wxPySaveThread(doSave);                                         \
@@ -152,11 +152,11 @@ static char* wxStringErrorMsg = "string type is required for parameter";
 #define PYCALLBACK__GCAINT(PCLASS, CBNAME)                              \
     void CBNAME(wxGridCellAttr *attr, int val) {                        \
         bool doSave = wxPyRestoreThread();                              \
-        if (m_myInst.findCallback(#CBNAME))                             \
-            m_myInst.callCallback(                                      \
-                Py_BuildValue("(Oi)",                                   \
-                              wxPyConstructObject((void*)attr, "wxGridCellAttr"),    \
-                              val));                                    \
+        if (m_myInst.findCallback(#CBNAME)) {                           \
+            PyObject* obj = wxPyConstructObject((void*)attr, "wxGridCellAttr");\
+            m_myInst.callCallback(Py_BuildValue("(Oi)", obj, val));     \
+            Py_DECREF(obj);                                             \
+        }                                                               \
         else                                                            \
             PCLASS::CBNAME(attr, val);                                  \
         wxPySaveThread(doSave);                                         \
@@ -199,8 +199,9 @@ static char* wxStringErrorMsg = "string type is required for parameter";
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b));   \
             if (ro) {                                                   \
-                rval = PyString_AsString(PyObject_Str(ro));             \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyString_AsString(str);                          \
+                Py_DECREF(ro);  Py_DECREF(str);                         \
             }                                                           \
         }                                                               \
         wxPySaveThread(doSave);                                         \
@@ -226,8 +227,9 @@ static char* wxStringErrorMsg = "string type is required for parameter";
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b));   \
             if (ro) {                                                   \
-                rval = PyString_AsString(PyObject_Str(ro));             \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyString_AsString(str);                          \
+                Py_DECREF(ro);  Py_DECREF(str);                         \
             }                                                           \
         } else                                                          \
             rval = PCLASS::CBNAME(a, b);                                \
@@ -300,8 +302,9 @@ static char* wxStringErrorMsg = "string type is required for parameter";
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",a,b));   \
             if (ro) {                                                   \
-                rval = PyFloat_AsDouble(PyObject_Str(ro));              \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyFloat_AsDouble(str);                           \
+                Py_DECREF(ro);   Py_DECREF(str);                        \
             }                                                           \
         } else                                                          \
             rval = PCLASS::CBNAME(a, b);                                \
@@ -372,8 +375,9 @@ static char* wxStringErrorMsg = "string type is required for parameter";
             PyObject* ro;                                               \
             ro = m_myInst.callCallbackObj(Py_BuildValue("(i)",a));      \
             if (ro) {                                                   \
-                rval = PyString_AsString(PyObject_Str(ro));             \
-                Py_DECREF(ro);                                          \
+                PyObject* str = PyObject_Str(ro);                       \
+                rval = PyString_AsString(str);                          \
+                Py_DECREF(ro);   Py_DECREF(str);                        \
             }                                                           \
         } else                                                          \
             rval = PCLASS::CBNAME(a);                                   \
@@ -710,7 +714,6 @@ public:
     PYCALLBACK__GCAINT(wxGridTableBase, SetColAttr);
 
 
-
     wxString GetValue(int row, int col) {
         bool doSave = wxPyRestoreThread();
         wxString rval;
@@ -718,8 +721,10 @@ public:
             PyObject* ro;
             ro = m_myInst.callCallbackObj(Py_BuildValue("(ii)",row,col));
             if (ro) {
-                rval = PyString_AsString(PyObject_Str(ro));
+                PyObject* str = PyObject_Str(ro);
+                rval = PyString_AsString(str);
                 Py_DECREF(ro);
+                Py_DECREF(str);
             }
         }
         wxPySaveThread(doSave);
index 60a70c5d8f73946550da07b5a03acdfef75ed765..9c04d9602e51f092c7c8ed145ccfc293c2f86647 100644 (file)
@@ -163,12 +163,14 @@ public:
     }
 
     void OnExit() {
+        bool doSave = wxPyRestoreThread();
         Py_DECREF(m_tagHandlerClass);
         m_tagHandlerClass = NULL;
         for (size_t x=0; x < m_objArray.GetCount(); x++) {
             PyObject* obj = (PyObject*)m_objArray.Item(x);
             Py_DECREF(obj);
         }
+        wxPySaveThread(doSave);
     };
 
     void FillHandlersTable(wxHtmlWinParser *parser) {
@@ -229,6 +231,7 @@ IMP_PYCALLBACK__STRING(wxPyHtmlWindow, wxHtmlWindow, OnSetTitle);
     if (m_myInst.findCallback("OnLinkClicked")) {
         PyObject* obj = wxPyConstructObject((void*)&link, "wxHtmlLinkInfo");
         m_myInst.callCallback(Py_BuildValue("(O)", obj));
+        Py_DECREF(obj);
     }
     else
         wxHtmlWindow::OnLinkClicked(link);
@@ -6273,6 +6276,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_wxClientDC","_class_wxClientDC",0},
     { "_wxMouseEvent","_class_wxMouseEvent",0},
@@ -6469,6 +6473,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxHtmlParser","_wxHtmlWinParser",SwigwxHtmlWinParserTowxHtmlParser},
     { "_wxHtmlParser","_class_wxHtmlParser",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index 8d7c08dca34f49b8c8d05d5c7325f720639081e6..62f601e4ad7809e48d6ba82f528278183623d979 100644 (file)
@@ -3188,6 +3188,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_wxBusyInfo","_class_wxBusyInfo",0},
     { "_class_wxMenuEvent","_wxMenuEvent",0},
     { "_wxPaletteChangedEvent","_class_wxPaletteChangedEvent",0},
+    { "_wxJoystick","_class_wxJoystick",0},
     { "_class_wxPyBitmapDataObject","_wxPyBitmapDataObject",0},
     { "_wxClientDC","_class_wxClientDC",0},
     { "_wxMouseEvent","_class_wxMouseEvent",0},
@@ -3382,6 +3383,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
     { "_class_wxCheckListBox","_wxCheckListBox",0},
     { "_wxHtmlParser","_class_wxHtmlParser",0},
     { "_class_wxBusyInfo","_wxBusyInfo",0},
+    { "_class_wxJoystick","_wxJoystick",0},
     { "_class_wxCommandEvent","_wxCommandEvent",0},
     { "_class_wxClientDC","_wxClientDC",0},
     { "_class_wxSizeEvent","_wxSizeEvent",0},
index 6384d02d5d3f464e23b01280c4217779b7dfdbbe..55c69c96149cbe29cb8b116ee4bd8dba8fbeccdf 100644 (file)
@@ -121,7 +121,9 @@ static char* wxStringErrorMsg = "string type is required for parameter";
             bool doSave = wxPyRestoreThread();
             wxRect* newRect = new wxRect(dest);
             obj = wxPyConstructObject((void*)newRect, "wxRect");
-            PyObject_SetAttrString(obj, "thisown", PyInt_FromLong(1));
+            PyObject* one = PyInt_FromLong(1);
+            PyObject_SetAttrString(obj, "thisown", one);
+            Py_DECREF(one);
             wxPySaveThread(doSave);
             return obj;
         }
index c391ffde0fb5d0a152805000d76102791483e434..cc97a57d90622d15ce1360f1faf780f0e8e7e957 100644 (file)
@@ -400,8 +400,10 @@ public:
         if (!PyObject_HasAttrString(py, name))
             return NULL;
         PyObject* o = PyObject_GetAttrString(py, name);
-        if (!PyMethod_Check(o) && !PyCFunction_Check(o))
+        if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
+            Py_DECREF(o);
             return NULL;
+        }
         return o;
     }
 
index b42c84180170f4a6afd76d219af0f5583f601e3a..349cc9245d0b4ccc51c1fb8ce4422a50ed8fad12 100644 (file)
@@ -264,7 +264,7 @@ static char* wxStringErrorMsg = "string type is required for parameter";
 
 //---------------------------------------------------------------------------
 // Typemap to convert strings to wxColour.  Two string formats are accepted,
-// either a colour name, for a hex colour spec like "#RRGGBB"
+// either a colour name, or a hex colour spec like "#RRGGBB"
 
 %typemap(python,in) wxColour& (wxColour temp) {
     $target = &temp;
index 2e87f237a90733138ea5c968e8dfb7915b05c0bf..84020cb3930c8fd28c0915f84671a3eb4b8c8e7d 100644 (file)
@@ -67,7 +67,9 @@
             Py_DECREF(arg);
 
             // set ThisOwn
-            PyObject_SetAttrString($target, "thisown", PyInt_FromLong(1));
+            PyObject* one = PyInt_FromLong(1);
+            PyObject_SetAttrString($target, "thisown", one);
+            Py_DECREF(one);
         }
     } else {
         Py_INCREF(Py_None);
@@ -371,8 +373,10 @@ public:
         if (!PyObject_HasAttrString(py, name))
             return NULL;
         PyObject* o = PyObject_GetAttrString(py, name);
-        if (!PyMethod_Check(o) && !PyCFunction_Check(o))
+        if (!PyMethod_Check(o) && !PyCFunction_Check(o)) {
+            Py_DECREF(o);
             return NULL;
+        }
         return o;
     }
 
index 27dbca27a09f1ac460c24e2a25135624e5713b6d..41e0f7f90d9de1d729402cf2892d83513c4b8426 100644 (file)
@@ -52,7 +52,7 @@
 //---------------------------------------------------------------------------
 
 
-#define __version__ "0.0.0"   // The real value is now in build.py...
+#define __version__ "0.0.0"   // The real value is now in setup.py...
 
 wxPoint     wxPyDefaultPosition;
 wxSize      wxPyDefaultSize;