From: Mikko Rasa Date: Thu, 28 Nov 2013 12:51:23 +0000 (+0200) Subject: Restore old samples value if create_targets fails X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6cfe786e84d9d9474c7bd5a78d1b5c92e3868e4e;p=libs%2Fgl.git Restore old samples value if create_targets fails An application could use try-catch to check if a certain level of multisampling is available, and leaving samples to that value would interfere with later operations. --- diff --git a/source/pipeline.cpp b/source/pipeline.cpp index 0df03ca7..d7e175de 100644 --- a/source/pipeline.cpp +++ b/source/pipeline.cpp @@ -49,8 +49,17 @@ void Pipeline::set_multisample(unsigned s) if(s==samples) return; + unsigned old_samples = samples; samples = s; - create_targets(1); + try + { + create_targets(1); + } + catch(...) + { + samples = old_samples; + throw; + } } void Pipeline::set_camera(const Camera *c)