You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'As of v1.3.2 (possibly earlier; this was when I updated from 1.2.4), libwebp has an extra dependency on
41
+
' libsharpyuv (bundled with PD). We must load this *prior* to loading any other webp dlls.
42
+
Private m_hLibSharpYUV AsLong
43
+
40
44
'Forcibly disable libwebp interactions at run-time (if newState is FALSE).
41
45
' Setting newState to TRUE is not advised; this module will handle state internally based
42
46
' on successful library loading.
@@ -77,14 +81,19 @@ Public Function InitializeEngine(ByRef pathToDLLFolder As String) As Boolean
77
81
78
82
'Initialize all webp libraries
79
83
Dim strLibPath AsString
84
+
85
+
'New to 1.3.2 is the sharpyuv lib which must be loaded *first*
86
+
strLibPath = pathToDLLFolder & "libsharpyuv.dll"
87
+
m_hLibSharpYUV = VBHacks.LoadLib(strLibPath)
88
+
89
+
'libwebp can now resolve dependencies correctly...
80
90
strLibPath = pathToDLLFolder & "libwebp.dll"
81
91
m_hLibWebP = VBHacks.LoadLib(strLibPath)
82
92
strLibPath = pathToDLLFolder & "libwebpdemux.dll"
83
93
m_hLibWebPDemux = VBHacks.LoadLib(strLibPath)
84
94
strLibPath = pathToDLLFolder & "libwebpmux.dll"
85
95
m_hLibWebPMux = VBHacks.LoadLib(strLibPath)
86
-
87
-
m_LibAvailable = (m_hLibWebP <> 0) And (m_hLibWebPDemux <> 0) And (m_hLibWebPMux <> 0)
96
+
m_LibAvailable = (m_hLibSharpYUV <> 0) And (m_hLibWebP <> 0) And (m_hLibWebPDemux <> 0) And (m_hLibWebPMux <> 0)
88
97
InitializeEngine = m_LibAvailable
89
98
90
99
If (Not InitializeEngine) Then PDDebug.LogAction "WARNING! LoadLibraryW failed to load one or more WebP libraries. Last DLL error: " & Err.LastDllError
@@ -96,18 +105,25 @@ Public Function IsWebPEnabled() As Boolean
96
105
End Function
97
106
98
107
PublicSubReleaseEngine()
99
-
If (m_hLibWebP <> 0) Then
100
-
VBHacks.FreeLib m_hLibWebP
101
-
m_hLibWebP = 0
108
+
109
+
'For extra safety, free in reverse order from loading
0 commit comments