mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Fix potential crash
Even though the code is running on the main thread, it might still run after the owning (C++) object has been destroyed.
This commit is contained in:
@@ -51,9 +51,11 @@ struct item_record_t : fs::event_callback_t
|
||||
|
||||
if(_scm_info)
|
||||
{
|
||||
_scm_info->add_callback(^(scm::ng::info_t const& info){
|
||||
_live.reset(new bool{true});
|
||||
std::weak_ptr<bool> isAlive = _live;
|
||||
|
||||
if(!_item.children)
|
||||
_scm_info->add_callback(^(scm::ng::info_t const& info){
|
||||
if(!isAlive.lock() || !_item.children)
|
||||
return;
|
||||
|
||||
std::set<std::string> pathsShown, pathsDeleted, pathsMissingOnDisk;
|
||||
@@ -293,6 +295,7 @@ private:
|
||||
std::string _path;
|
||||
struct timespec _last_modified;
|
||||
scm::ng::info_ptr _scm_info;
|
||||
std::shared_ptr<bool> _live;
|
||||
};
|
||||
|
||||
@implementation FSDirectoryDataSource
|
||||
|
||||
Reference in New Issue
Block a user