Open issue

Moderator: Telldus

Post Reply
krambriw
Posts: 654
Joined: Fri Mar 17, 2023 9:45 am

Open issue

Post by krambriw »

Hi,

I still have an open issue left.

My TellStickDuo plugin for EventGhost works almost fine except in two cases:

- when I stop & restart the plugin
- when I delete the plugin

In those cases above, I get exceptions due to that the following method is still missing

Code: Select all

tdUnregisterCallback
When I start the plugin, I use the following code

Code: Select all

        self.dll.tdInit()
        self.deviceEventProc = DEVICEEVENTPROC(self.deviceEventCallback)
        self.deviceChangeEventProc = DEVICECHANGEEVENTPROC(self.deviceChangeEventCallback)
        self.deviceRawEventProc = RAWDEVICEEVENTPROC(self.deviceRawEventCallback)
        self.callbackId_0 = self.dll.tdRegisterDeviceEvent(self.deviceEventProc, 0)        
        self.callbackId_1 = self.dll.tdRegisterDeviceChangeEvent(self.deviceChangeEventProc, 0)        
        self.callbackId_2 = self.dll.tdRegisterRawDeviceEvent(self.deviceRawEventProc, 0)        
When I stop the plugin, the following code is executed

Code: Select all

        unReg_0 = self.dll.tdUnregisterCallback( self.callbackId_0 )
        unReg_1 = self.dll.tdUnregisterCallback( self.callbackId_1 )
        unReg_2 = self.dll.tdUnregisterCallback( self.callbackId_2 )
        self.dll.tdReleaseString(self.callbackId_0)
        self.dll.tdReleaseString(self.callbackId_1)
        self.dll.tdReleaseString(self.callbackId_2)
        self.dll.tdClose()
        print "Disables TellStick Duo..."
Restarting the plugin again gives this exception

Code: Select all

13:06:31   Error starting plugin: TellStickDuo
13:06:31   Traceback (most recent call last) (1397):
13:06:31     File "C:\Program Files\EventGhost\eg\Classes\PluginInstanceInfo.py", line 176, in Start
13:06:31       self.instance.__start__(*self.args)
13:06:31     File "C:\Program Files\EventGhost\plugins\TellStickDuo\__init__.py", line 98, in __start__
13:06:31       self.callbackId_0 = self.dll.tdRegisterDeviceEvent(self.deviceEventProc, 0)
13:06:31   WindowsError: exception: access violation reading 0x08890202

When I delete the plugin, similar code as above is executed

Code: Select all

        unReg_0 = self.dll.tdUnregisterCallback( self.callbackId_0 )
        unReg_1 = self.dll.tdUnregisterCallback( self.callbackId_1 )
        unReg_2 = self.dll.tdUnregisterCallback( self.callbackId_2 )
        self.dll.tdReleaseString(self.callbackId_0)
        self.dll.tdReleaseString(self.callbackId_1)
        self.dll.tdReleaseString(self.callbackId_2)
        self.dll.tdClose()
        print "Closing TellStick Duo..."
And the exception looks like this (a bit longer)

Code: Select all

13:12:03   Unhandled exception in WorkerThread <ActionThread>:
13:12:03   Callers stack:
13:12:03     File "threading.pyc", line 497, in __bootstrap
13:12:03     File "threading.pyc", line 525, in __bootstrap_inner
13:12:03     File "threading.pyc", line 477, in run
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 177, in __MainLoop
13:12:03       self.__DoOneEvent()
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 202, in __DoOneEvent
13:12:03       action.PrintUnhandledException()
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\ActionThread.py", line 92, in HandleAction
13:12:03       pluginInfo.treeItem.Refresh()
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 77, in __call__
13:12:03       self.processed.set()
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\PluginItem.py", line 124, in Delete
13:12:03       self.info = None
13:12:03   Traceback (most recent call last) (1397):
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 200, in __DoOneEvent
13:12:03       self.HandleAction(action)
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\ActionThread.py", line 87, in HandleAction
13:12:03       action()
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\ThreadWorker.py", line 70, in __call__
13:12:03       self.returnValue = self.func(*self.args, **self.kwargs)
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\PluginItem.py", line 118, in DoIt
13:12:03       info.Close()
13:12:03     File "C:\Program Files\EventGhost\eg\Classes\PluginInstanceInfo.py", line 231, in Close
13:12:03       self.instance.__close__()
13:12:03     File "C:\Program Files\EventGhost\plugins\TellStickDuo\__init__.py", line 116, in __close__
13:12:03       unReg_0 = self.dll.tdUnregisterCallback( self.callbackId_0 )
13:12:03   WindowsError: exception: access violation reading 0x00000000
Regardless, it all drills down to an access violation. I believe this is because the tdUnregisterCallback is not implemented and therefore the memory is not released correctly


Best regards, Walter

My latest plugin is attached:
TellStickDuo_25.02.2011.zip
(173.97 KiB) Downloaded 592 times
Post Reply