XMouseListener breaks after first useage

I realize that this is an issue that seems to affect OpenOffice and not LibreOffice, thus far I’ve not had luck finding a solution. It IS however related to the UNO Api and macro/extension coding, and as such I’m hoping that the people here whom are smarter than I can be of some service. So here goes…

I’ve an issue where an XMouseListener action is misbehaving after the first time it is fired. The first time it functions normally, however afterwards, it seems to randomly stop executing the code it’s running. The following code is the mousePressed method, with way too much logging so that I could figure out what was going on.

def mousePressed(self, event):
    """Handle click event from tab labels"""
    LOG.info('Click event fired.')
        tab_clicked = event.Source.Text
    except Exception:
        LOG.warning('Error getting text from event source.')

    # Run away if we didn't click on a tab label
    LOG.info('Check that tab is in tab list.')
    if tab_clicked not in self.tab_list:
        LOG.info('"%s" not a registered tab.' % tab_clicked)

    LOG.info('Tab "%s" clicked.' % tab_clicked)
    if tab_clicked == self.active_tab:
        LOG.info('Tab page unchanged.')
    LOG.info('Setting active tab to new value')
    self.active_tab = tab_clicked

    LOG.info('Click event finished. Returning...')
    # return True  # I've played with various return values just in case it mattered

The first time something is clicked, everything works as it’s supposed to. Any time after that however, it seems to randomly stop executing the action, without throwing any errors. Usually the last log message I see is “Check that tab is in tab list.”, however sometimes I see ‘Tab “Options” clicked.’ The first line of the setter for active tab also has a log statement as its first line of executed code. Occasionally I see its message ‘Attempting to set new value “Options” as active tab’. For whatever reason, it seems to be aborted, mid execution, but I am unsure as to why.

I’ve included the full code I’m working with here: http://dpaste.com/1760423/ if it is of much use to anyone for debugging this. Note that the dialog attribute specified in the TabManager class is not a dialog model or object, but rather a custom dialog class that I use for easily drawing dialogs in a happy pain free way. :wink:

Even more oddly, this issue only happens on OpenOffice 3.1 on Windows. I haven’t been able to get a version as old as OpenOffice 3.1 to build on Linux, but this works fine on 3.5 and 3.6 on Linux and Windows (LibreOffice and OpenOffice). Unfortunately due to a legacy application I have to support as far back as version OpenOffice 3.1, hence my dilemma.

Can anyone suggest a reason that this would fail in this fashion? I’ve tried everything I can think of and I’m really starting to feel crazy. I’m open to alternative means of determining label clicks, etc… I just need to get something rolling soon.

P.S. Don’t even get me started on why I’m making a tab implementation that’s so mind blowingly stupid. Explaining that piece alone would take me longer than I care to get into, sufficed to say I really could just use a hand with this from a technical level.

^ Beautiful right? … RIGHT!!! :frowning: