davidben / nspluginwrapper

A cross-platform NPAPI plugin viewer
http://nspluginwrapper.org
GNU General Public License v2.0
23 stars 10 forks source link

Delayed NPP_Destroy causes windowless plugins to hang on to deleted Pixmap #20

Closed davidben closed 13 years ago

davidben commented 13 years ago

Not yet sure what's going on. Some log data:

*** NSPlugin Wrapper *** NPP_NewStream return: 0 [NPERR_NO_ERROR], stype=NP_NORMAL
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53f07b0 rect.top=0 rect.left=74 rect.bottom=186 rect.right=300
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect instance=0xe7c76e80 rect.top=0 rect.left=0 rect.bottom=90 rect.right=288
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53b87e0 rect.top=0 rect.left=0 rect.bottom=90 rect.right=288
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect instance=0xe7c76e80 rect.top=9 rect.left=472 rect.bottom=78 rect.right=702
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53b87e0 rect.top=9 rect.left=472 rect.bottom=78 rect.right=702
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect instance=0xe7c76e80 rect.top=0 rect.left=299 rect.bottom=66 rect.right=419
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53b87e0 rect.top=0 rect.left=299 rect.bottom=66 rect.right=419
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Wrapper *** NPP_WriteReady instance=0x53f0240

(npviewer.bin:26327): Gdk-WARNING **: GdkWindow 0x6e00540 unexpectedly destroyed
*** NSPlugin Viewer  *** NPN_InvalidateRect instance=0x8e251e8 rect.top=0 rect.left=74 rect.bottom=186 rect.right=300
*** NSPlugin Viewer  ***   handle_NPP_WriteReady
*** NSPlugin Viewer  ***   NPP_WriteReady instance=0x9253b68, stream=0x9a9aee0
*** NSPlugin Viewer  ***   NPP_WriteReady return: 268435455
*** NSPlugin Wrapper *** NPP_WriteReady return: 268435455
*** NSPlugin Wrapper *** NPP_Write instance=0x53f0240
*** NSPlugin Viewer  ***   handle_NPP_Write
*** NSPlugin Viewer  ***   NPP_Write instance=0x9253b68, stream=0x9a9aee0, offset=0, len=49, buf=0x9a46628
*** NSPlugin Viewer  ***   NPP_Write return: 49
*** NSPlugin Wrapper *** NPP_Write return: 49
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53f07b0 rect.top=0 rect.left=74 rect.bottom=186 rect.right=300
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect instance=0xe7c76e80 rect.top=0 rect.left=0 rect.bottom=90 rect.right=288
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53b87e0 rect.top=0 rect.left=0 rect.bottom=90 rect.right=288
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect instance=0xe7c76e80 rect.top=9 rect.left=472 rect.bottom=78 rect.right=702
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53b87e0 rect.top=9 rect.left=472 rect.bottom=78 rect.right=702
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect instance=0xe7c76e80 rect.top=0 rect.left=299 rect.bottom=66 rect.right=419
*** NSPlugin Wrapper *** handle_NPN_InvalidateRect
*** NSPlugin Wrapper *** NPN_InvalidateRect instance=0x53b87e0 rect.top=0 rect.left=299 rect.bottom=66 rect.right=419
*** NSPlugin Wrapper *** NPN_InvalidateRect done
*** NSPlugin Viewer  *** NPN_InvalidateRect done
*** NSPlugin Wrapper *** NPP_DestroyStream instance=0x53f0240

(npviewer.bin:26327): Gdk-WARNING **: GdkWindow 0x6e0053f unexpectedly destroyed

(npviewer.bin:26327): Gdk-WARNING **: GdkWindow 0x6e0053e unexpectedly destroyed

(npviewer.bin:26327): Gdk-WARNING **: GdkWindow 0x6e0053b unexpectedly destroyed
*** NSPlugin Viewer  *** handle_NPP_DestroyStream
*** NSPlugin Viewer  *** NPP_DestroyStream instance=0x9253b68, stream=0x9a9aee0, reason=NPRES_DONE
*** NSPlugin Viewer  *** NPP_DestroyStream return: 0 [NPERR_NO_ERROR]
*** NSPlugin Wrapper *** NPP_DestroyStream return: 0 [NPERR_NO_ERROR]
*** NSPlugin Wrapper *** NPP_URLNotify instance=0x53f0240, url='...', reason=NPRES_DONE, notifyData=0x8a
*** NSPlugin Viewer  *** g_NPP_Destroy_Now
*** NSPlugin Viewer  *** NPP_Destroy instance=0x944ec80
*** NSPlugin Viewer  ***   NPN_ReleaseObject 
*** NSPlugin Viewer  ***   NPN_ReleaseObject npobj=0x9364d34
*** NSPlugin Viewer  ***     handle_NPP_URLNotify
*** NSPlugin Viewer  ***     NPP_URLNotify instance=0x9253b68, url='...', reason=NPRES_DONE, notifyData=0x8a
*** NSPlugin Viewer  ***     NPP_URLNotify done
*** NSPlugin Wrapper *** NPP_URLNotify done
*** NSPlugin Wrapper *** handle_NPN_ReleaseObject
*** NSPlugin Wrapper *** NPN_ReleaseObject npobj=0x53f0980
*** NSPlugin Wrapper *** NPN_ReleaseObject done (refcount: 1)
*** NSPlugin Viewer  ***   NPN_ReleaseObject done (refcount: 1)
The program 'npviewer.bin' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
  (Details: serial 6108 error_code 3 request_code 18 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
*** NSPlugin Wrapper *** plugin_kill, connection 0x5346460
*** NSPlugin Wrapper *** plugin_exit
*** NSPlugin Wrapper *** Restart plugins viewer

The X errors may be much later because of async stuff. I don't think NPN_InvalidateRect causes a sync. May want an xtrace.

davidben commented 13 years ago

There was a delayed NPP_Destroy, that is visible way at the end there. I believe the BadWindow errors actually occurred back when the Gdk-WARNINGs occur. Those are likely because the pixmap we try to draw on has already disappeared, but we don't know that yet, so we keep drawing. This may be a little tricky...

davidben commented 13 years ago

Tentatively marking this closed since the sync-event stuff has been merged to master.