From 0a1370ed96982d3a792a8009534ce52104138c03 Mon Sep 17 00:00:00 2001 From: Marcelo Date: Fri, 8 Sep 2017 21:35:20 -0300 Subject: [PATCH] Fix possible crash at ~EditorExportPlatformBB10 --- platform/bb10/export/export.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/platform/bb10/export/export.cpp b/platform/bb10/export/export.cpp index 9e02a2a7ca0..86ce8f608aa 100644 --- a/platform/bb10/export/export.cpp +++ b/platform/bb10/export/export.cpp @@ -719,6 +719,8 @@ EditorExportPlatformBB10::EditorExportPlatformBB10() { if (can_export()) { device_thread = Thread::create(_device_poll_thread, this); devices_changed = true; + } else { + device_thread = NULL; } Image img(_bb10_logo); @@ -764,9 +766,16 @@ bool EditorExportPlatformBB10::can_export(String *r_error) const { EditorExportPlatformBB10::~EditorExportPlatformBB10() { quit_request = true; - Thread::wait_to_finish(device_thread); - memdelete(device_lock); - memdelete(device_thread); + if (device_thread) { + Thread::wait_to_finish(device_thread); + memdelete(device_thread); + device_thread = NULL; + } + + if (device_lock) { + memdelete(device_lock); + device_lock = NULL; + } } void register_bb10_exporter() {