]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
added a check which should prevent the crash of bug 555111
[wxWidgets.git] / src / generic / grid.cpp
index 024de20fb01792a6209215ed5a6a001f5105b106..5ff1ee3ecb6d2fbe761cc2c9938aebfcbe3e160e 100644 (file)
@@ -4397,7 +4397,11 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
 
     if ( event.Dragging() )
     {
-        m_isDragging = TRUE;
+        if (!m_isDragging)
+        {
+            m_isDragging = TRUE;
+            m_rowLabelWin->CaptureMouse();
+        }
 
         if ( event.LeftIsDown() )
         {
@@ -4443,8 +4447,14 @@ void wxGrid::ProcessRowLabelMouseEvent( wxMouseEvent& event )
         return;
     }
 
-    m_isDragging = FALSE;
+    if ( m_isDragging && (event.Entering() || event.Leaving()) )
+        return;
 
+    if (m_isDragging)
+    {
+        m_rowLabelWin->ReleaseMouse();
+        m_isDragging = FALSE;
+    }
 
     // ------------ Entering or leaving the window
     //
@@ -4583,7 +4593,11 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
 
     if ( event.Dragging() )
     {
-        m_isDragging = TRUE;
+        if (!m_isDragging)
+        {
+            m_isDragging = TRUE;
+            m_colLabelWin->CaptureMouse();
+        }
 
         if ( event.LeftIsDown() )
         {
@@ -4629,8 +4643,14 @@ void wxGrid::ProcessColLabelMouseEvent( wxMouseEvent& event )
         return;
     }
 
-    m_isDragging = FALSE;
+    if ( m_isDragging && (event.Entering() || event.Leaving()) )
+        return;
 
+    if (m_isDragging)
+    {
+        m_colLabelWin->ReleaseMouse();
+        m_isDragging = FALSE;
+    }
 
     // ------------ Entering or leaving the window
     //