Crash with CaptureMouse() / ReleaseMouse()

Hello wxpython-users,

Have you ever experienced some crash when using CaptureMouse() with wxPython ?

With the attached file : If you click down on the Red Rectangle, and then move away the mouse to the Windows taskbar, and release the mouse
up
there, then there is a crash !

(Do it twice, 3 times … or maximum 5 times, you will probably have a crash, at least on Windows 7).

Remark : if you remove line #14 or line #13, no more crash : this proves that the problem comes when 2 events are bound to an object (the problem is not there when only 1 event is bound to the object).

Do you have an idea ?

Best, J

___ CODE ___

import wx

from wx.lib.floatcanvas import FloatCanvas

class TestFrame(wx.Frame):

def __init__(self, *args, **kwargs):

    wx.Frame.__init__(self, *args, **kwargs)

    self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor = "DARK SLATE BLUE")

    MainSizer = wx.BoxSizer(wx.VERTICAL)

    MainSizer.Add(self.canvas, 4, wx.EXPAND)

    self.SetSizer(MainSizer)

    self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)

    A = self.canvas.AddRectangle((10,10), (100, 20), FillColor="red")

    A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)

    A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp)    #  Comment this line, no more crash

    wx.CallAfter(self.canvas.ZoomToBB)

                   

def OnLeftDown(self, event):

    print 'Left Button down clicked at:', event.Coords

   

def OnRectDown(self, event):

    print 'Rectangle: Left Button down clicked at:', event.HitCoords

    self.canvas.CaptureMouse()

   

def OnRectUp(self, event):

    print 'Rectangle: Left Button up clicked at:', event.HitCoords

    if self.canvas.HasCapture():

        self.canvas.ReleaseMouse()

app = wx.App(0)

frame = TestFrame(None, title = “Mouse Event Tester”)

frame.Show(True)

app.MainLoop()

capturemouse_bug.py (1.26 KB)

Hello wxpython-users,

Have you ever experienced some crash when using CaptureMouse() with wxPython ?

With the attached file : If you click down on the Red Rectangle, and then move away the mouse to the Windows taskbar, and release the mouse
up
there, then there is a crash !

(Do it twice, 3 times … or maximum 5 times, you will probably have a crash, at least on Windows 7).

Remark : if you remove line #14 or line #13, no more crash : this proves that the problem comes when 2 events are bound to an object (the problem is not there when only 1 event is bound to the object).

Do you have an idea ?

Best, J

___ CODE ___

import wx

from wx.lib.floatcanvas import FloatCanvas

class TestFrame(wx.Frame):

def __init__(self, *args, **kwargs):
    wx.Frame.__init__(self, *args, **kwargs)
    self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor = "DARK SLATE BLUE")
    MainSizer = wx.BoxSizer(wx.VERTICAL)
    MainSizer.Add(self.canvas, 4, wx.EXPAND)
    self.SetSizer(MainSizer)
    self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
    A = self.canvas.AddRectangle((10,10), (100, 20), FillColor="red")
    A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)
    A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp)    #  Comment this line, no more crash
    wx.CallAfter(self.canvas.ZoomToBB)
def OnLeftDown(self, event):
    print 'Left Button down clicked at:', event.Coords
def OnRectDown(self, event):
    print 'Rectangle: Left Button down clicked at:', event.HitCoords
    self.canvas.CaptureMouse()
def OnRectUp(self, event):
    print 'Rectangle: Left Button up clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()

app = wx.App(0)

frame = TestFrame(None, title = “Mouse Event Tester”)

frame.Show(True)

app.MainLoop()

Yeah, the idea is that you can’t capture the mouse more than once.
Just do the Hascapture/ReleaseMouse block check before any CaptureMouse call.
Simple enough, is safe, and it doesn’t hurt much anything with normal user behavior performance.

def OnRectDown(self, event):
    print 'Rectangle: Left Button down clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()
    self.canvas.CaptureMouse()
def OnRectUp(self, event):
    print 'Rectangle: Left Button up clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()

I really don’t see any need to have a mouse capture more than once. Maybe only in a really strange situation.

If you are progamatically capturing the mouse many times really fast(think macro) then you have what would be abnormal behavior occuring and this might cause issues.
If the user is only expected to physically use their mouse, then just do as I mentioned with HasCapture, otherwise you will be playing a whole new ball game, which requires a lot of tweaking, which might change intended end result(ex: when using in conjunction with custom mouse software)

···

On Sunday, March 9, 2014 10:15:15 AM UTC-5, Basj wrote:

It looks like the capture block needs to be implemented in the actual library resource, but placing that block in your code also is always a good idea.
Ask Chris Barker to took into it in the mouse event handler defs. I recall he does most of the FloatCanvas stuff.

···

On Sunday, March 9, 2014 11:30:03 AM UTC-5, Metallicow wrote:

On Sunday, March 9, 2014 10:15:15 AM UTC-5, Basj wrote:

Hello wxpython-users,

Have you ever experienced some crash when using CaptureMouse() with wxPython ?

With the attached file : If you click down on the Red Rectangle, and then move away the mouse to the Windows taskbar, and release the mouse
up
there, then there is a crash !

(Do it twice, 3 times … or maximum 5 times, you will probably have a crash, at least on Windows 7).

Remark : if you remove line #14 or line #13, no more crash : this proves that the problem comes when 2 events are bound to an object (the problem is not there when only 1 event is bound to the object).

Do you have an idea ?

Best, J

___ CODE ___

import wx

from wx.lib.floatcanvas import FloatCanvas

class TestFrame(wx.Frame):

def __init__(self, *args, **kwargs):
    wx.Frame.__init__(self, *args, **kwargs)
    self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor = "DARK SLATE BLUE")
    MainSizer = wx.BoxSizer(wx.VERTICAL)
    MainSizer.Add(self.canvas, 4, wx.EXPAND)
    self.SetSizer(MainSizer)
    self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
    A = self.canvas.AddRectangle((10,10), (100, 20), FillColor="red")
    A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)
    A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp)    #  Comment this line, no more crash
    wx.CallAfter(self.canvas.ZoomToBB)
def OnLeftDown(self, event):
    print 'Left Button down clicked at:', event.Coords
def OnRectDown(self, event):
    print 'Rectangle: Left Button down clicked at:', event.HitCoords
    self.canvas.CaptureMouse()
def OnRectUp(self, event):
    print 'Rectangle: Left Button up clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()

app = wx.App(0)

frame = TestFrame(None, title = “Mouse Event Tester”)

frame.Show(True)

app.MainLoop()

Yeah, the idea is that you can’t capture the mouse more than once.
Just do the Hascapture/ReleaseMouse block check before any CaptureMouse call.
Simple enough, is safe, and it doesn’t hurt much anything with normal user behavior performance.

def OnRectDown(self, event):
    print 'Rectangle: Left Button down clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()
    self.canvas.CaptureMouse()
def OnRectUp(self, event):
    print 'Rectangle: Left Button up clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()

I really don’t see any need to have a mouse capture more than once. Maybe only in a really strange situation.

If you are progamatically capturing the mouse many times really fast(think macro) then you have what would be abnormal behavior occuring and this might cause issues.
If the user is only expected to physically use their mouse, then just do as I mentioned with HasCapture, otherwise you will be playing a whole new ball game, which requires a lot of tweaking, which might change intended end result(ex: when using in conjunction with custom mouse software)

Hi Mettalicow,

Thanks for your answer.

Yeah, the idea is that you can’t capture the mouse more than once.
Just do the Hascapture/ReleaseMouse block check before any CaptureMouse call.
Simple enough, is safe, and it doesn’t hurt much anything with normal user behavior performance.

It is a good idea, but unfortunately, it does not solve the problem : if you try my original code + your modification (with if self.canvas.HasCapture(): etc.)

you can still have this crash.

I’m using standard Win7 64 + I retried with the latest version of wxpython + FloatCanvas as well as a standard 3.0.0.0 version.

In both cases I can get crash after 3 or 4 or 5 times of “click down + move mouse to the taskbar + release the mouse button there”

Something with which I am sure : no crash at all if only 1 event is bound to the rectangle A : the crashes appear only when 2 events are bound to the rectangle A.

(example in my code : FloatCanvas.EVT_FC_LEFT_UP, FloatCanvas.EVT_FC_LEFT_DOWN)

Any other idea to solve this crash problem ?

I really don’t see any need to have a mouse capture more than once. Maybe only in a really strange situation.

If you are progamatically capturing the mouse many times really fast(think macro) then you have what would be abnormal behavior occuring and this might cause issues.
If the user is only expected to physically use their mouse, then just do as I mentioned with HasCapture, otherwise you will be playing a whole new ball game, which requires a lot of tweaking, which might change intended end result(ex: when using in conjunction with custom mouse software)

(By the way, you’re right : no, I don’t need that, I don’t need a mouse capture more than once).

Best regards, J

Ahh, I see what is crashing it now.
Hmmm…
Made a few quick edits to the library stuff and it didn’t work, so your best bet is to hit up Chris or Robin.
I am not that real familiar with the FloatCanvas code as I haven’t really used it a lot in projects, so hopefully one of those two will have a quick fix for you.
But here is a hacked copy of your sample if this may provide some insight into how you may want to go about working around the issue in the meantime.
You might want to plug Chris directly if anyone else doesn’t notice what your problem is or have a fix in about a week/few days.

It does seem to be a library issue tho. So if you go into your wx package, you can also try to attempt to fix the library code also if you want to try and figure out a patch that works.
Sorry besides the bit I posted, ATM I really wouldn’t know where else to start looking.

capturemouse_bug_hack.py (2.1 KB)

···

On Sunday, March 9, 2014 4:03:34 PM UTC-5, Basj wrote:

Hi Mettalicow,

Thanks for your answer.

Yeah, the idea is that you can’t capture the mouse more than once.
Just do the Hascapture/ReleaseMouse block check before any CaptureMouse call.
Simple enough, is safe, and it doesn’t hurt much anything with normal user behavior performance.

It is a good idea, but unfortunately, it does not solve the problem : if you try my original code + your modification (with if self.canvas.HasCapture(): etc.)

you can still have this crash.

I’m using standard Win7 64 + I retried with the latest version of wxpython + FloatCanvas as well as a standard 3.0.0.0 version.

In both cases I can get crash after 3 or 4 or 5 times of “click down + move mouse to the taskbar + release the mouse button there”

Something with which I am sure : no crash at all if only 1 event is bound to the rectangle A : the crashes appear only when 2 events are bound to the rectangle A.

(example in my code : FloatCanvas.EVT_FC_LEFT_UP, FloatCanvas.EVT_FC_LEFT_DOWN)

Any other idea to solve this crash problem ?

I really don’t see any need to have a mouse capture more than once. Maybe only in a really strange situation.

If you are progamatically capturing the mouse many times really fast(think macro) then you have what would be abnormal behavior occuring and this might cause issues.
If the user is only expected to physically use their mouse, then just do as I mentioned with HasCapture, otherwise you will be playing a whole new ball game, which requires a lot of tweaking, which might change intended end result(ex: when using in conjunction with custom mouse software)

(By the way, you’re right : no, I don’t need that, I don’t need a mouse capture more than once).

Best regards, J

With the attached file : If you click down on the Red Rectangle, and then
move away the mouse to the Windows taskbar, and release the mouse up there,
then there is a crash !

(Do it twice, 3 times ... or maximum 5 times, you will probably have a

crash, at least on Windows 7).

Testing now -- on the Mac, with wx 2.9.4.0, I have a hard time getting ot
to crash, but I do get a crash now and again if I click a LOT and really
fast... kind of hard to duplicate....

But trying really hard to crash it, it did not crash with the binding to
self.OnRectUp not called.

1) It would be good to try to duplicate this without FloatCanvas in the
loop -- it may or may not be a FloatCanvas issue.

2) But -- I noticed something:
   Whether you have the CaptureMouse call or not -- sometimes releasing the
mouse triggers the OnRectUp callback, and sometimes it doesn't -- this
seems to point to a problem deeper int eh lib, not in FloatCanvas or
wxPython, in fact. But still mysterious. Also, the OnRectUP gets triggered
even when the mouse is not over the REct -- even outside teh Window, so
that's probably not right.

Also: What are you trying to do here? Capturing the Mouse and object-bound
events is a odd combination. You Capture the mouse because you want events
outside the window to still register with the Window -- floatCanvas uses
this for when you are zooming or Panning, you want the mouse movement to be
handles as if the Window were bigger than it is.

But in the example given, if I read it correctly, you want the mouse to
remain captured until there is a mouse-up event on the rectangle itself --
do you need to Capture it at all? what are you doing with the mouse move
events? Do you need them when the mouse is outside the window?

I also note that FloatCanvas unconditionally releases the mouse on a LeftUp
event anyway. So if you want teh muse captured if the muse is released, but
not on the rect, then that's not going to work anyway. I might be abel to
remove that ReleaseMouse call (or move it into the GUImodes), but that
makes me a bit nervous.

I'll poke at it some more...

-Chris

···

On Sun, Mar 9, 2014 at 9:40 AM, Metallicow <metaliobovinus@gmail.com> wrote:

*Remark : if you remove line #14 or line #13, no more crash : this
proves that the problem comes when 2 events are bound to an object (the
problem is not there when only 1 event is bound to the object).*

Do you have an idea ?

Best, J

___ CODE ___

import wx
from wx.lib.floatcanvas import FloatCanvas

class TestFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor =
"DARK SLATE BLUE")
        MainSizer = wx.BoxSizer(wx.VERTICAL)
        MainSizer.Add(self.canvas, 4, wx.EXPAND)
        self.SetSizer(MainSizer)
        self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
        A = self.canvas.AddRectangle((10,10), (100, 20),
FillColor="red")
        A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)
        A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp) # Comment
this line, no more crash
        wx.CallAfter(self.canvas.ZoomToBB)

    def OnLeftDown(self, event):
        print 'Left Button down clicked at:', event.Coords

    def OnRectDown(self, event):
        print 'Rectangle: Left Button down clicked at:', event.HitCoords
        self.canvas.CaptureMouse()

    def OnRectUp(self, event):
        print 'Rectangle: Left Button up clicked at:', event.HitCoords
        if self.canvas.HasCapture():
            self.canvas.ReleaseMouse()

app = wx.App(0)
frame = TestFrame(None, title = "Mouse Event Tester")
frame.Show(True)
app.MainLoop()

Yeah, the idea is that you can't capture the mouse more than once.
Just do the Hascapture/ReleaseMouse block check before any CaptureMouse
call.
Simple enough, is safe, and it doesn't hurt much anything with normal
user behavior performance.

    def OnRectDown(self, event):
        print 'Rectangle: Left Button down clicked at:', event.HitCoords
        if self.canvas.HasCapture():
            self.canvas.ReleaseMouse()
        self.canvas.CaptureMouse()

    def OnRectUp(self, event):
        print 'Rectangle: Left Button up clicked at:', event.HitCoords
        if self.canvas.HasCapture():
            self.canvas.ReleaseMouse()

I really don't see any need to have a mouse capture more than once. Maybe
only in a really strange situation.

If you are progamatically capturing the mouse many times really
fast(think macro) then you have what would be abnormal behavior occuring
and this might cause issues.
If the user is only expected to physically use their mouse, then just do
as I mentioned with HasCapture, otherwise you will be playing a whole new
ball game, which requires a lot of tweaking, which might change intended
end result(ex: when using in conjunction with custom mouse software)

It looks like the capture block needs to be implemented in the actual
library resource, but placing that block in your code also is always a good
idea.
Ask Chris Barker to took into it in the mouse event handler defs. I recall
he does most of the FloatCanvas stuff.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

NOTE:

This is a hard crash: Ideally, wxPython should never crash, even if you have “wrong” Python code – i.e calling CaptureMouse or ReleaseMouse incorrectly.

So if we can come up with the easiest possible. way to duplicate this, maybe Robin can debug it.

For me on OS-X, it’s intermittent, so hard to reproduce.

-Chris

···

On Sun, Mar 9, 2014 at 8:15 AM, Basj nouvellecollection@gmail.com wrote:

Hello wxpython-users,

Have you ever experienced some crash when using CaptureMouse() with wxPython ?

With the attached file : If you click down on the Red Rectangle, and then move away the mouse to the Windows taskbar, and release the mouse
up
there, then there is a crash !

(Do it twice, 3 times … or maximum 5 times, you will probably have a crash, at least on Windows 7).

Remark : if you remove line #14 or line #13, no more crash : this proves that the problem comes when 2 events are bound to an object (the problem is not there when only 1 event is bound to the object).

Do you have an idea ?

Best, J

___ CODE ___

import wx

from wx.lib.floatcanvas import FloatCanvas

class TestFrame(wx.Frame):

def __init__(self, *args, **kwargs):
    wx.Frame.__init__(self, *args, **kwargs)
    self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor = "DARK SLATE BLUE")
    MainSizer = wx.BoxSizer(wx.VERTICAL)
    MainSizer.Add(self.canvas, 4, wx.EXPAND)
    self.SetSizer(MainSizer)
    self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
    A = self.canvas.AddRectangle((10,10), (100, 20), FillColor="red")
    A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)
    A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp)    #  Comment this line, no more crash
    wx.CallAfter(self.canvas.ZoomToBB)
def OnLeftDown(self, event):
    print 'Left Button down clicked at:', event.Coords
def OnRectDown(self, event):
    print 'Rectangle: Left Button down clicked at:', event.HitCoords
    self.canvas.CaptureMouse()
def OnRectUp(self, event):
    print 'Rectangle: Left Button up clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()

app = wx.App(0)

frame = TestFrame(None, title = “Mouse Event Tester”)

frame.Show(True)

app.MainLoop()

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax

Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

OK,

So some poking around, and I found a bug, which may or may not have anything to do with this crash:

When the mouse was captured (and sometimes when not – which is odd) – a LeftUp event would be raised when the mouse was outside the Window – it would have the window relative coordinates that were bigger than teh Window size - i.e. less than zero or greater than the width (height) of the Window.

Oddly, in this case, the code would check the color of that pixel in the hit-test bitmap, and rather than raising an error, or coming back with always the same color ((0,0,0), maybe?) it came back with a color that sometimes matched an objects hit color – I suspect it was “wrapping around” and hit an arbitrary pixel.

Anyway, I’ve put in a check, so that it won’t even check the hit color if the mouse event is outside the Window.

I haven’t gotten it to crash with this change – though it was intermittent for me anyway.

Try the latest FloatCanvas from SVN

-Chris

···

On Mon, Mar 10, 2014 at 10:16 AM, Chris Barker chris.barker@noaa.gov wrote:

NOTE:

This is a hard crash: Ideally, wxPython should never crash, even if you have “wrong” Python code – i.e calling CaptureMouse or ReleaseMouse incorrectly.

So if we can come up with the easiest possible. way to duplicate this, maybe Robin can debug it.

For me on OS-X, it’s intermittent, so hard to reproduce.

-Chris

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax

Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

On Sun, Mar 9, 2014 at 8:15 AM, Basj nouvellecollection@gmail.com wrote:

Hello wxpython-users,

Have you ever experienced some crash when using CaptureMouse() with wxPython ?

With the attached file : If you click down on the Red Rectangle, and then move away the mouse to the Windows taskbar, and release the mouse
up
there, then there is a crash !

(Do it twice, 3 times … or maximum 5 times, you will probably have a crash, at least on Windows 7).

Remark : if you remove line #14 or line #13, no more crash : this proves that the problem comes when 2 events are bound to an object (the problem is not there when only 1 event is bound to the object).

Do you have an idea ?

Best, J

___ CODE ___

import wx

from wx.lib.floatcanvas import FloatCanvas

class TestFrame(wx.Frame):

def __init__(self, *args, **kwargs):
    wx.Frame.__init__(self, *args, **kwargs)
    self.canvas =FloatCanvas.FloatCanvas(self, BackgroundColor = "DARK SLATE BLUE")
    MainSizer = wx.BoxSizer(wx.VERTICAL)
    MainSizer.Add(self.canvas, 4, wx.EXPAND)
    self.SetSizer(MainSizer)
    self.canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown)
    A = self.canvas.AddRectangle((10,10), (100, 20), FillColor="red")
    A.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.OnRectDown)
    A.Bind(FloatCanvas.EVT_FC_LEFT_UP, self.OnRectUp)    #  Comment this line, no more crash
    wx.CallAfter(self.canvas.ZoomToBB)
def OnLeftDown(self, event):
    print 'Left Button down clicked at:', event.Coords
def OnRectDown(self, event):
    print 'Rectangle: Left Button down clicked at:', event.HitCoords
    self.canvas.CaptureMouse()
def OnRectUp(self, event):
    print 'Rectangle: Left Button up clicked at:', event.HitCoords
    if self.canvas.HasCapture():
        self.canvas.ReleaseMouse()

app = wx.App(0)

frame = TestFrame(None, title = “Mouse Event Tester”)

frame.Show(True)

app.MainLoop()

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice

7600 Sand Point Way NE (206) 526-6329 fax

Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

@ basj: test and say thank you. :slight_smile:

The two files you need are here.
http://wx.ibaku.net/changelog/?t=2&c=250
r76112: 2014-03-10 19:26:36 [CHB] Chris Barker

Yep, this fixed it on MSWindows dropped over the 3.0 preview build which can be found here. http://wxpython.kosoftworks.com/preview/20140104/
Thanks Chris.

Won’t crash when clicking down in the red rect and then dragging mouse out of frame and releasing mouse.

···

On Monday, March 10, 2014 2:33:53 PM UTC-5, Chris Barker wrote:

OK,

So some poking around, and I found a bug, which may or may not have anything to do with this crash:

When the mouse was captured (and sometimes when not – which is odd) – a LeftUp event would be raised when the mouse was outside the Window – it would have the window relative coordinates that were bigger than teh Window size - i.e. less than zero or greater than the width (height) of the Window.

Oddly, in this case, the code would check the color of that pixel in the hit-test bitmap, and rather than raising an error, or coming back with always the same color ((0,0,0), maybe?) it came back with a color that sometimes matched an objects hit color – I suspect it was “wrapping around” and hit an arbitrary pixel.

Anyway, I’ve put in a check, so that it won’t even check the hit color if the mouse event is outside the Window.

I haven’t gotten it to crash with this change – though it was intermittent for me anyway.

Try the latest FloatCanvas from SVN

-Chris

Great! thanks for testing. This was an odd one, and I'm still not quite
sure what was triggering the actual crash (though it may have been trying
to check the color of pixel way off of a bitmap.... But there was incorrect
behavior in any case, so it was good to find that.

If anyone confirms it works on other platforms/wx versions, that would be
great.

-Chris

···

On Mon, Mar 10, 2014 at 6:45 PM, Metallicow <metaliobovinus@gmail.com>wrote:

Yep, this fixed it on MSWindows dropped over the 3.0 preview build which
can be found here. http://wxpython.kosoftworks.com/preview/20140104/

--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Many many thanks Chris and Metallicow ! The problem is solved on my machine too (windows 7). Thanks again !
See you, J

···

On Tuesday, March 11, 2014 5:03:20 PM UTC+1, Chris Barker wrote:

On Mon, Mar 10, 2014 at 6:45 PM, Metallicow metalio...@gmail.com wrote:

Yep, this fixed it on MSWindows dropped over the 3.0 preview build which can be found here. http://wxpython.kosoftworks.com/preview/20140104/

Great! thanks for testing. This was an odd one, and I’m still not quite sure what was triggering the actual crash (though it may have been trying to check the color of pixel way off of a bitmap… But there was incorrect behavior in any case, so it was good to find that.

If anyone confirms it works on other platforms/wx versions, that would be great.

-Chris

Christopher Barker, Ph.D.

Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris....@noaa.gov