File: 0001-Fix-Wx-_load_plugin-segfaulting-when-wxPluginManager.patch

package info (click to toggle)
libwx-perl 1%3A0.9923-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,236 kB
  • ctags: 2,407
  • sloc: cpp: 11,021; perl: 8,615; ansic: 710; makefile: 48
file content (34 lines) | stat: -rw-r--r-- 968 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 067aacc2dc8ab1b02286693656df801e08dec49e Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Thu, 14 Aug 2014 21:50:00 +0000
Subject: [PATCH 1/3] Fix Wx::_load_plugin() segfaulting when
 wxPluginManager::LoadLibrary fails

It would be nice to also signal an error message upwards in the caller
stack, but I can't see an easy way to set dl_last_error in DynaLoader
from here.

Bug-Debian: https://bugs.debian.org/758127
---
 Wx.xs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Wx.xs b/Wx.xs
index 01029fc..3f5dede 100644
--- a/Wx.xs
+++ b/Wx.xs
@@ -422,7 +422,10 @@ _load_plugin( string, int flags = 0 /* to be compatible with dl_load_file */ )
 #endif
 #endif
     wxDynamicLibrary *lib = wxPluginManager::LoadLibrary( string, wxDL_VERBATIM );
-    RETVAL = PTR2IV( lib->GetLibHandle() );
+    if (lib)
+        RETVAL = PTR2IV( lib->GetLibHandle() );
+    else
+        RETVAL = 0;
   OUTPUT:
     RETVAL
 
-- 
2.1.0.rc1