Indigo client crashing after calling menuitem 3 times

Posted on
Mon Mar 07, 2016 5:35 pm
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Indigo client crashing after calling menuitem 3 times

I have begun to write a plugin and everything has been going along quite well until now.

I have defined a MenuItems.XML that looks like this:
Code: Select all
<?xml version="1.0"?>
<MenuItems>
    <MenuItem id="menu1">
        <Name>Update last notification time...</Name>
        <CallbackMethod>updateLastNotificationTimeManually</CallbackMethod>
        <ButtonTitle>Update</ButtonTitle>
        <ConfigUI>
         <Field id="targetDevice" type="menu">
            <Label>Device:</Label>
            <List class="indigo.devices" filter="com.perceptiveautomation.indigoplugin.notification"/>
         </Field>
         <Field id="newValue" type="textfield">
            <Label>New time value (Y-m-d H:m:s):</Label>
         </Field>
        </ConfigUI>
    </MenuItem>
</MenuItems>


The callback method looks like this:

Code: Select all
   def updateLastNotificationTimeManually ( self, valuesDict, typeId ):
      
      if self.extDebug: self.debugLog(u"updateLastNotificationTimeManually action called: props: %s" % (str(valuesDict)))
      
      try:
         dev = indigo.devices[int(valuesDict[u'targetDevice'])]
         dev.updateStateOnServer(u'lastNotificationTime',valuesDict[u'newValue'])
         indigo.server.log(u'Last notification time for device "%s" set to %s' % (dev.name, valuesDict[u'newValue']))
         return True
      except:
         self.ErrorLog(u'Could not update last notification time manually')
         return


Now, if I run this menu item three times the Indigo client (not the server) will crash on the third time. There are no errors in the Indigo log. The indigo client has also crashed randomly without calling this method, but only after I added the method. Is there something wrong with the above code, or should I look somewhere else for the error?

Posted on
Mon Mar 07, 2016 6:31 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Indigo client crashing after calling menuitem 3 times

There are a couple of things, but none should cause a crash. First, there is no "com.perceptiveautomation.indigoplugin.notification" filter. Second, you should just return, not return True. Last, unless you defined it, there is no self.ErrorLog method (it's self.errorLog). Again, nothing seems like it would cause a crash though.

When it crashes the 3rd time, where does it crash? You should be able to tell based on your logging - what's the last line of logging do you see? Also, there should be a crash log in ~/Library/Logs/CrashReporter/ with a title that contains "Indigo 6" - you can email that to us at support@indigodomo.com (include a link to this thread).

Also, is it crashing after you click the button 3 times without closing/opening the dialog? Are you clicking it very quickly?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Mar 07, 2016 6:48 pm
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Re: Indigo client crashing after calling menuitem 3 times

Thanks for the quick reply!

jay (support) wrote:
There are a couple of things, but none should cause a crash. First, there is no "com.perceptiveautomation.indigoplugin.notification" filter.

If I don't include the filter, all devices are returned. I want to include just the devices of "my" plugin and this seems to do just that

jay (support) wrote:
Second, you should just return, not return True.

If I don't return True I'm not able to close the dialog box (throws an error), see attached image. If I return True this solves that (?)

jay (support) wrote:
Last, unless you defined it, there is no self.ErrorLog method (it's self.errorLog). Again, nothing seems like it would cause a crash though.

Updated, thanks


jay (support) wrote:
When it crashes the 3rd time, where does it crash? You should be able to tell based on your logging - what's the last line of logging do you see? Also, there should be a crash log in ~/Library/Logs/CrashReporter/ with a title that contains "Indigo 6" - you can email that to us at support@indigodomo.com (include a link to this thread).

Also, is it crashing after you click the button 3 times without closing/opening the dialog? Are you clicking it very quickly?


Thanks, I will e-mail the crash log.
No, it crashes the third time I open the dialog. 1st time -> successfully updated device state, 2nd time -> successfully updated device state, 3rd time -> crash
I will send you a screenshot also.
Attachments
Skjermbilde 2016-03-08 kl. 01.35.18.png
Skjermbilde 2016-03-08 kl. 01.35.18.png (23.31 KiB) Viewed 1419 times

Posted on
Mon Mar 07, 2016 7:01 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Indigo client crashing after calling menuitem 3 times

Got the crash log, we'll look at that.

Have you added return True to the error case as well?

Note: please do NOT use com.perceptiveautomation or com.indigodomo as the first part of your plugin's ID: that's reserved for our use and if you use it there could be naming collisions later. We use domain names explicitly for this. You probably don't have a domain name, and that's fine, just use something else that would seem like it would be uniquely yours.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Mon Mar 07, 2016 7:05 pm
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Re: Indigo client crashing after calling menuitem 3 times

Ah, got it. I started off using one of your plugins and thought that all plugin IDs should start with that, my bad. That may also be related to why Indigo would crash?
I will update the plugin ID and check if that changes anything, but that will take some time.

No, I have not added return True to the error case

Posted on
Tue Mar 08, 2016 7:19 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Indigo client crashing after calling menuitem 3 times

This was indeed a bug (and a crasher at that). It should be fixed in Indigo 6.1.7 which we just released. Thanks for providing the details to us.

Image

Posted on
Tue Mar 08, 2016 7:31 pm
krissh offline
Posts: 105
Joined: Nov 18, 2012
Location: Norway

Re: Indigo client crashing after calling menuitem 3 times

Thanks for brilliant and super quick support 8)

I've tested it quickly now and it does seem to work :)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 11 guests