screencast: Don't leak recorders on failure

ShellRecorder.record() may fail, remove the recorder from the map
in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=737846
This commit is contained in:
Florian Müllner 2014-10-03 16:49:21 +02:00
parent f02b007337
commit 4ed4bb330e

View File

@ -117,6 +117,8 @@ const ScreencastService = new Lang.Class({
this._applyOptionalParameters(recorder, options); this._applyOptionalParameters(recorder, options);
let [success, fileName] = recorder.record(); let [success, fileName] = recorder.record();
returnValue = [success, fileName ? fileName : '']; returnValue = [success, fileName ? fileName : ''];
if (!success)
this._stopRecordingForSender(sender);
} }
invocation.return_value(GLib.Variant.new('(bs)', returnValue)); invocation.return_value(GLib.Variant.new('(bs)', returnValue));
@ -150,6 +152,8 @@ const ScreencastService = new Lang.Class({
this._applyOptionalParameters(recorder, options); this._applyOptionalParameters(recorder, options);
let [success, fileName] = recorder.record(); let [success, fileName] = recorder.record();
returnValue = [success, fileName ? fileName : '']; returnValue = [success, fileName ? fileName : ''];
if (!success)
this._stopRecordingForSender(sender);
} }
invocation.return_value(GLib.Variant.new('(bs)', returnValue)); invocation.return_value(GLib.Variant.new('(bs)', returnValue));