Ensure the plugin's native code is never called with an invalid NPP pointer.
diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
index 69e4854..f79d9ac 100644
--- a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
+++ b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
@@ -40,6 +40,7 @@
extern ANPSurfaceInterfaceV0 gSurfaceI;
extern ANPSystemInterfaceV0 gSystemI;
extern ANPTypefaceInterfaceV0 gTypefaceI;
+extern ANPWindowInterfaceV0 gWindowI;
#define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
@@ -53,6 +54,9 @@
BackgroundPlugin::BackgroundPlugin(NPP inst) : SurfaceSubPlugin(inst) {
+ // initialize the java interface
+ m_javaInterface = NULL;
+
// initialize the drawing surface
m_surface = NULL;
@@ -71,6 +75,7 @@
}
BackgroundPlugin::~BackgroundPlugin() {
+ setJavaInterface(NULL);
surfaceDestroyed();
}