From cd684d4fb3cff61d4e9ebaa8a4a34d2553a779fc Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Sat, 10 Mar 2007 23:40:45 +0000 Subject: [PATCH] instead of using the Imager type typemap entry use the Imager::ImgRef type and wrap it. This avoids the leak in that entry pre Imager 0.56. RT #24992 --- Screenshot.pm | 6 ++++-- Screenshot.xs | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Screenshot.pm b/Screenshot.pm index 52e3c81..c8ecd4a 100644 --- a/Screenshot.pm +++ b/Screenshot.pm @@ -94,8 +94,10 @@ sub screenshot { Imager->_set_error(Imager->_error_as_msg()); return; } - - return $result; + + # RT #24992 - the Imager typemap entry is broken pre-0.56, so + # wrap it here + return bless { IMG => $result }, "Imager"; } sub have_win32 { diff --git a/Screenshot.xs b/Screenshot.xs index 1892aa1..335b3d4 100644 --- a/Screenshot.xs +++ b/Screenshot.xs @@ -16,7 +16,7 @@ PROTOTYPES: DISABLE #ifdef SS_WIN32 -Imager +Imager::ImgRaw imss_win32(hwnd, include_decor = 0, left = 0, top = 0, right = 0, bottom = 0) unsigned hwnd int include_decor @@ -29,7 +29,7 @@ imss_win32(hwnd, include_decor = 0, left = 0, top = 0, right = 0, bottom = 0) #ifdef SS_X11 -Imager +Imager::ImgRaw imss_x11(display, window_id, left = 0, top = 0, right = 0, bottom = 0) unsigned long display int window_id -- 2.30.2