aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/examples/demo/ex_canvas_paint.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wx/examples/demo/ex_canvas_paint.erl')
-rw-r--r--lib/wx/examples/demo/ex_canvas_paint.erl19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/wx/examples/demo/ex_canvas_paint.erl b/lib/wx/examples/demo/ex_canvas_paint.erl
index 9bc083766a..17c7ad9cac 100644
--- a/lib/wx/examples/demo/ex_canvas_paint.erl
+++ b/lib/wx/examples/demo/ex_canvas_paint.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2009-2011. All Rights Reserved.
+%% Copyright Ericsson AB 2009-2012. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -239,14 +239,17 @@ draw(Canvas, Bitmap, Fun) ->
wxMemoryDC:destroy(MemoryDC).
redraw(DC, Bitmap) ->
- MemoryDC = wxMemoryDC:new(Bitmap),
-
- wxDC:blit(DC, {0,0},
- {wxBitmap:getWidth(Bitmap), wxBitmap:getHeight(Bitmap)},
- MemoryDC, {0,0}),
+ try
+ MemoryDC = wxMemoryDC:new(Bitmap),
- wxMemoryDC:destroy(MemoryDC).
+ wxDC:blit(DC, {0,0},
+ {wxBitmap:getWidth(Bitmap), wxBitmap:getHeight(Bitmap)},
+ MemoryDC, {0,0}),
+ wxMemoryDC:destroy(MemoryDC)
+ catch error:{{badarg,_},_} -> %% Bitmap have been deleted
+ ok
+ end.
-getPageInfo(_This) ->
+getPageInfo(_This) ->
{1,1,1,1}.