File tree Expand file tree Collapse file tree
Source/KNSoft.MakeLifeEasier/Shell Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ Shell_EnumVirtualDesktops(
139139{
140140 HRESULT hr ;
141141 IObjectArray * Desktops ;
142- UINT Count ;
142+ UINT Count , i ;
143143 IVirtualDesktop * Desktop ;
144144
145145 if (!IS_NT_VERSION_GE (NT_VERSION_WIN11_24H2 ))
@@ -154,21 +154,23 @@ Shell_EnumVirtualDesktops(
154154 hr = Desktops -> lpVtbl -> GetCount (Desktops , & Count );
155155 if (FAILED (hr ))
156156 {
157- return hr ;
157+ goto _Exit ;
158158 }
159- for (UINT i = 0 ; i < Count ; i ++ )
159+ for (i = 0 ; i < Count ; i ++ )
160160 {
161161 hr = Desktops -> lpVtbl -> GetAt (Desktops , i , & IID_IVirtualDesktop , & Desktop );
162- if (SUCCEEDED (hr ))
162+ if (FAILED (hr ))
163163 {
164- if (!Callback (Desktop , i , Context ))
165- {
166- return S_FALSE ;
167- }
168- } else
164+ goto _Exit ;
165+ }
166+ if (!Callback (Desktop , i , Context ))
169167 {
170- return hr ;
168+ hr = S_FALSE ;
169+ goto _Exit ;
171170 }
172171 }
173- return S_OK ;
172+
173+ _Exit :
174+ Desktops -> lpVtbl -> Release (Desktops );
175+ return hr ;
174176}
You can’t perform that action at this time.
0 commit comments