| Index: samplecode/SampleApp.cpp | 
| diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp | 
| index 1b4a55e5dd0a88d93d6fc730e9223d20e9c6528d..3d2aa7c57399cb0a570a11650d8072b067e4df6e 100644 | 
| --- a/samplecode/SampleApp.cpp | 
| +++ b/samplecode/SampleApp.cpp | 
| @@ -259,8 +259,12 @@ public: | 
|  | 
| virtual void tearDownBackend(SampleWindow *win) { | 
| #if SK_SUPPORT_GPU | 
| -        SkSafeUnref(fCurContext); | 
| -        fCurContext = NULL; | 
| +        if (fCurContext) { | 
| +            // in case we have outstanding refs to this guy (lua?) | 
| +            fCurContext->abandonContext(); | 
| +            fCurContext->unref(); | 
| +            fCurContext = NULL; | 
| +        } | 
|  | 
| SkSafeUnref(fCurIntf); | 
| fCurIntf = NULL; | 
|  |