From 0e0d3446ba3a68e274d5581071ddc61e781d5263 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 16 Aug 2016 12:55:50 +0200 Subject: [PATCH] free file descriptor when closing file --- src/Mod/Raytracing/Gui/Command.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/Raytracing/Gui/Command.cpp b/src/Mod/Raytracing/Gui/Command.cpp index ef5e8e685..4868d3883 100644 --- a/src/Mod/Raytracing/Gui/Command.cpp +++ b/src/Mod/Raytracing/Gui/Command.cpp @@ -655,11 +655,12 @@ void CmdRaytracingRender::activated(int iMsg) h << height; std::string par = hGrp->GetASCII("OutputParameters", "+P +A"); doCommand(Doc,"PageFile = open(App.activeDocument().%s.PageResult,'r')",Sel[0].getFeatName()); - doCommand(Doc,"import subprocess,tempfile"); - doCommand(Doc,"TempFile = tempfile.mkstemp(suffix='.pov')[1]"); + doCommand(Doc,"import os,subprocess,tempfile"); + doCommand(Doc,"fd, TempFile = tempfile.mkstemp(suffix='.pov')"); doCommand(Doc,"f = open(TempFile,'wb')"); doCommand(Doc,"f.write(PageFile.read())"); doCommand(Doc,"f.close()"); + doCommand(Doc,"os.close(fd)"); #ifdef FC_OS_WIN32 // http://povray.org/documentation/view/3.6.1/603/ doCommand(Doc,"subprocess.call('\"%s\" %s +W%s +H%s +O\"%s\" /EXIT /RENDER '+TempFile)",renderer.c_str(),par.c_str(),w.str().c_str(),h.str().c_str(),fname.c_str());