Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/29/19 17:45:06 (5 years ago)
Author:
ddorfmei
Message:

#2931: solved the issues found during the review

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2931_OR-Tools_LP_MIP/HeuristicLab.ExtLibs/HeuristicLab.OrTools/6.10.0/HeuristicLab.OrTools-6.10.0/Plugin.cs.frame

    r16373 r16582  
    2121
    2222using System;
     23using System.Diagnostics;
    2324using System.IO;
    2425using System.Linq;
     
    3536  [PluginFile("Google.OrTools_version.txt", PluginFileType.Data)]
    3637  [PluginFile("Google.Protobuf.dll", PluginFileType.Assembly)]
    37   [PluginFile("glpk_4_65.dll", PluginFileType.NativeDll)]
    38   [PluginFile("glpk-license.txt", PluginFileType.License)]
    3938  public class HeuristicLabOrToolsPlugin : PluginBase {
    4039
    41     ~HeuristicLabOrToolsPlugin() {
    42       OnUnload(); // HACK: remove once ticket #2961 is resolved
    43     }
    44 
    4540    public override void OnUnload() {
    46       base.OnUnload();
    47 
     41      // HACK: free handle to native DLL used temporarily by the Hive Slave
     42      // should be solved for all native DLLs used by the Hive Slave
    4843      var dllDir = new FileInfo(GetType().Assembly.Location).Directory;
    49       if (dllDir == null)
     44      if (dllDir == null || !dllDir.FullName.Contains(Path.DirectorySeparatorChar + "PluginTemp" + Path.DirectorySeparatorChar))
    5045        return;
    5146
     
    5651
    5752      foreach (var nativeDll in dllDir.EnumerateFiles().Where(f => nativeDlls.Contains(f.Name))) {
     53        if (Process.GetCurrentProcess().Modules.Cast<ProcessModule>().All(m => m.ModuleName != nativeDll.Name))
     54          continue;
     55
    5856        var handle = LoadLibrary(nativeDll.FullName);
    5957        if (handle == IntPtr.Zero)
Note: See TracChangeset for help on using the changeset viewer.