vnc2video
vnc2video copied to clipboard
Move Canvas and Renderer initialization to DefaultClientServerInitHandler
The nil pointer deference
errors described in #11 and #12 were caused by canvas and renderers not being properly initialized/configured.
- In
example/client/main.go
, renderers are configured afterffmpeg
is started. https://github.com/amitbet/vnc2video/blob/9d50b9dab1d92afd6c71ca5ccc5157135c121428/example/client/main.go#L89-L95 - But the VNC message handlers are started during the
Connect
call. https://github.com/amitbet/vnc2video/blob/9d50b9dab1d92afd6c71ca5ccc5157135c121428/example/client/main.go#L60 - This means that
RemoveCursor
/PaintCursor
(which requires renderers to be linked with canvas) inDefaultClientMessageHandler
could be called before the renderers are ready (by.SetTargetImage(screenImage)
in step 1) https://github.com/amitbet/vnc2video/blob/9d50b9dab1d92afd6c71ca5ccc5157135c121428/client.go#L302-L306
#12 proposed that RemoveCursort
should ignore missing canvas, but a more fundamental fix is to perform the renderer configuration in DefaultClientServerInitHandler
right after the size of the canvas is known.