Conflict with ToasterBox and MessageDialog

Hey I noticed an issue in my app with ToasterBoxes and MessageDialogs.

It only seems to happen if the ToasterBox is from a different frame (or possibly from a different parent). But if a MessageDialog appears while the ToasterBox is visible a focus deadlock happens when the toaster box tries to close. You can’t select any other window because message dialog is modal, but the toaster box seems to get the focus back (?) while it’s trying to close. I’m not entirely sure the reason for the problem but that’s what it appears like.

Oddly it works ok if the toaster box dialog is already showing when the toaster box comes up.

I’ve attached a demo which displays the behaviour. If you wait for the toaster box to appear, click the dialog button to pop the dialog and leave it up until the toaster tries to close you should be able to see the problem (everything stops responding)

dialogtoasted.py (1.31 KB)

I should mention I’m running wx 2.8.12.1 (mac-unicode) on python 2.7.2 on OSX 10.6.8

Hi Paul,

Hey I noticed an issue in my app with ToasterBoxes and MessageDialogs.

It only seems to happen if the ToasterBox is from a different frame (or possibly from a different parent). But if a MessageDialog appears while the ToasterBox is visible a focus deadlock happens when the toaster box tries to close. You can't select any other window because message dialog is modal, but the toaster box seems to get the focus back (?) while it's trying to close. I'm not entirely sure the reason for the problem but that's what it appears like.

Oddly it works ok if the toaster box dialog is already showing when the toaster box comes up.

I've attached a demo which displays the behaviour. If you wait for the toaster box to appear, click the dialog button to pop the dialog and leave it up until the toaster tries to close you should be able to see the problem (everything stops responding)

I don't see this here, the focus jumps to the toasterbox and back to the message dialog and so on and I can also go to other windows unrelated to this.

BTW, the app doesn't close as one can't close the second frame. I changed it a bit so it closes when the first frame is closed and simplified the message dialog call, using 'with'.

Werner

dialogtoasted.py (1.46 KB)

···

On 29/03/2012 12:14, Paul wrote:

Works fine with no problems for me:
Windows 7-32 bit
Python 2.6
wx 2.8.12.1 (msw-unicode)

Gadget/Steve

···

On 29/03/2012 11:24 AM, Paul Wiseman wrote:

I should mention I'm running wx 2.8.12.1 (mac-unicode) on python 2.7.2
on OSX 10.6.8 --
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

I should mention I’m running wx 2.8.12.1 (mac-unicode) on python 2.7.2

on OSX 10.6.8 –
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Works fine with no problems for me:

Windows 7-32 bit

Python 2.6

wx 2.8.12.1 (msw-unicode)

Gadget/Steve

Hmmm interesting, maybe just a mac issue?

···

On 29 March 2012 12:29, Gadget/Steve GadgetSteve@live.co.uk wrote:

On 29/03/2012 11:24 AM, Paul Wiseman wrote:

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Try with the wxPython 2.9.3 cocoa build, I wasn't able to duplicate the problem there.

···

On 3/29/12 3:24 AM, Paul Wiseman wrote:

I should mention I'm running wx 2.8.12.1 (mac-unicode) on python 2.7.2
on OSX 10.6.8

--
Robin Dunn
Software Craftsman

I should mention I’m running wx 2.8.12.1 (mac-unicode) on python 2.7.2

on OSX 10.6.8

Try with the wxPython 2.9.3 cocoa build, I wasn’t able to duplicate the problem there.

Interestingly the problem happens on 2.9.3 carbon but not cocoa. Any idea what I can do to solve this?

···

On 29 March 2012 17:44, Robin Dunn robin@alldunn.com wrote:

On 3/29/12 3:24 AM, Paul Wiseman wrote:

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Hi Paul,

Hey I noticed an issue in my app with ToasterBoxes and MessageDialogs.

It only seems to happen if the ToasterBox is from a different frame (or possibly from a different parent). But if a MessageDialog appears while the ToasterBox is visible a focus deadlock happens when the toaster box tries to close. You can’t select any other window because message dialog is modal, but the toaster box seems to get the focus back (?) while it’s trying to close. I’m not entirely sure the reason for the problem but that’s what it appears like.

Oddly it works ok if the toaster box dialog is already showing when the toaster box comes up.

I’ve attached a demo which displays the behaviour. If you wait for the toaster box to appear, click the dialog button to pop the dialog and leave it up until the toaster tries to close you should be able to see the problem (everything stops responding)

I don’t see this here, the focus jumps to the toasterbox and back to the message dialog and so on and I can also go to other windows unrelated to this.

BTW, the app doesn’t close as one can’t close the second frame. I changed it a bit so it closes when the first frame is closed and simplified the message dialog call, using ‘with’.

OK Thanks werner, It does that if the toaster pops after the dialog shows, but if you time it so you pop the dialog whilst the toaster is already up you should see it

···

On 29 March 2012 11:39, werner wbruhin@free.fr wrote:

On 29/03/2012 12:14, Paul wrote:

Werner

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

It still works here, but I am on Win with Py 2.7.2 and wxPy 2.9.3.2
and you and Robin seem to have established that it is a Mac issue.

Werner
···

On 29/03/2012 21:12, Paul Wiseman wrote:

On 29 March 2012 11:39, werner wbruhin@free.fr > wrote:

Hi Paul,

        On 29/03/2012 12:14, Paul wrote:
          Hey I noticed an issue in my app with ToasterBoxes and

MessageDialogs.

          It only seems to happen if the ToasterBox is from a

different frame (or possibly from a different parent). But
if a MessageDialog appears while the ToasterBox is visible
a focus deadlock happens when the toaster box tries to
close. You can’t select any other window because message
dialog is modal, but the toaster box seems to get the
focus back (?) while it’s trying to close. I’m not
entirely sure the reason for the problem but that’s what
it appears like.

          Oddly it works ok if the toaster box dialog is already

showing when the toaster box comes up.

          I've attached a demo which displays the behaviour. If you

wait for the toaster box to appear, click the dialog
button to pop the dialog and leave it up until the toaster
tries to close you should be able to see the problem
(everything stops responding)

      I don't see this here, the focus jumps to the toasterbox and

back to the message dialog and so on and I can also go to
other windows unrelated to this.

      BTW, the app doesn't close as one can't close the second

frame. I changed it a bit so it closes when the first frame
is closed and simplified the message dialog call, using
‘with’.

      OK Thanks werner, It does that if the toaster pops after

the dialog shows, but if you time it so you pop the dialog
whilst the toaster is already up you should see it

I’m on wxPython 2.9.4 cocoa build and able to reproduce this issue.

Nilay

···

On Thursday, March 29, 2012 10:14:47 PM UTC+5:30, Robin Dunn wrote:

On 3/29/12 3:24 AM, Paul Wiseman wrote:

I should mention I’m running wx 2.8.12.1 (mac-unicode) on python 2.7.2
on OSX 10.6.8
Try with the wxPython 2.9.3 cocoa build, I wasn’t able to duplicate the
problem there.


Robin Dunn
Software Craftsman
http://wxPython.org

I'm on wxPython 2.9.4 cocoa build and able to reproduce this issue.

Nilay

Just incase you're interested this is the temporary fix I put in place. I
just use these subclasses when I need a message dialog or message box, and
they close any toaster messages to prevent the deadlock. Not ideal but it
was the best I could do :slight_smile:

Just looking at it again now, it should probably have some locking as this
might still not work if the timing is bad. (or throw an error from the list
being mutated)

from wx.lib.agw import toasterbox as TB
import wx

class MessageDialogFix(wx.MessageDialog):
    """Fix where if toaster boxes have STAY_ON_TOP flag, when message
dialogs try to
    become modal, there's a clash and the app stops responding, this fix
just closes
    all tray pop ups to avoid the issue"""
    def __init__(self,*args,**kwargs):
        delete_all_pops()
        wx.MessageDialog.__init__(self,*args,**kwargs)

def MessageBoxFix(*args,**kwargs):
    delete_all_pops()
    return wx.MessageBox(*args,**kwargs)

def delete_all_pops():
    for win in TB.winlist:
        if not isinstance(win,wx._core._wxPyDeadObject):
            win.Close()
    TB.winlist=

···

On 20 November 2013 11:41, Nilay Anand <nilayanand@gmail.com> wrote:

On Thursday, March 29, 2012 10:14:47 PM UTC+5:30, Robin Dunn wrote:

On 3/29/12 3:24 AM, Paul Wiseman wrote:
> I should mention I'm running wx 2.8.12.1 (mac-unicode) on python 2.7.2
> on OSX 10.6.8

Try with the wxPython 2.9.3 cocoa build, I wasn't able to duplicate the
problem there.

--
Robin Dunn
Software Craftsman
http://wxPython.org

--

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/groups/opt_out.

I'm on wxPython 2.9.4 cocoa build and able to reproduce this issue.

Nilay

Just incase you're interested this is the temporary fix I put in place. I
just use these subclasses when I need a message dialog or message box, and
they close any toaster messages to prevent the deadlock. Not ideal but it
was the best I could do :slight_smile:

Just looking at it again now, it should probably have some locking as this
might still not work if the timing is bad. (or throw an error from the list
being mutated)

from wx.lib.agw import toasterbox as TB
import wx

class MessageDialogFix(wx.MessageDialog):
    """Fix where if toaster boxes have STAY_ON_TOP flag, when message
dialogs try to
    become modal, there's a clash and the app stops responding, this fix
just closes
    all tray pop ups to avoid the issue"""
    def __init__(self,*args,**kwargs):
        delete_all_pops()
        wx.MessageDialog.__init__(self,*args,**kwargs)

def MessageBoxFix(*args,**kwargs):
    delete_all_pops()
    return wx.MessageBox(*args,**kwargs)

def delete_all_pops():
    for win in TB.winlist:
        if not isinstance(win,wx._core._wxPyDeadObject):
            win.Close()
    TB.winlist=

No idea why I did one as a subclass and one as a factory.. actually only
just noticed that. But you get the idea :slight_smile:

···

On 20 November 2013 15:45, Paul Wiseman <poalman@gmail.com> wrote:

On 20 November 2013 11:41, Nilay Anand <nilayanand@gmail.com> wrote:

On Thursday, March 29, 2012 10:14:47 PM UTC+5:30, Robin Dunn wrote:

On 3/29/12 3:24 AM, Paul Wiseman wrote:
> I should mention I'm running wx 2.8.12.1 (mac-unicode) on python 2.7.2
> on OSX 10.6.8

Try with the wxPython 2.9.3 cocoa build, I wasn't able to duplicate the
problem there.

--
Robin Dunn
Software Craftsman
http://wxPython.org

--

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/groups/opt_out.