diff --git a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
index f126ede..8129f62 100644
--- a/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
+++ b/core/modules/views_ui/lib/Drupal/views_ui/ViewUI.php
@@ -775,7 +775,7 @@ public function cacheSet() {
    *   TRUE if the view is locked, FALSE otherwise.
    */
   public function isLocked() {
-    return is_object($this->lock) && ($this->lock->owner != $GLOBALS['user']->id());
+    return is_object($this->lock) && ($this->lock->owner != \Drupal::currentUser()->id());
   }
 
   /**
diff --git a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php
index 3c42487..4e3bc53 100644
--- a/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php
+++ b/core/modules/views_ui/tests/Drupal/views_ui/Tests/ViewUIObjectTest.php
@@ -12,6 +12,7 @@
 use Drupal\views\ViewExecutable;
 use Drupal\views_ui\ViewUI;
 use Symfony\Component\DependencyInjection\Container;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
 
 /**
  * Tests the ViewUI class.
@@ -74,4 +75,46 @@ public function testEntityDecoration() {
     $view_ui->isNew();
   }
 
+  /**
+   * Tests the isLocked method.
+   */
+  public function testIsLocked() {
+    $storage = $this->getMock('Drupal\views\Entity\View', array(), array(array(), 'view'));
+    $executable = $this->getMockBuilder('Drupal\views\ViewExecutable')
+      ->disableOriginalConstructor()
+      ->setConstructorArgs(array($storage))
+      ->getMock();
+    $account = $this->getMock('Drupal\Core\Session\AccountInterface');
+    $account->expects($this->exactly(2))
+      ->method('id')
+      ->will($this->returnValue(1));
+
+    $container = new ContainerBuilder();
+    $container->set('current_user', $account);
+    \Drupal::setContainer($container);
+
+    $view_ui = new ViewUI($storage, $executable);
+
+    // A view_ui without a lock object is not locked.
+    $this->assertFalse($view_ui->isLocked());
+
+    // Set the lock object with a different owner than the mocked account above.
+    $lock = (object) array(
+      'owner' => 2,
+      'data' => array(),
+      'updated' => REQUEST_TIME,
+    );
+    $view_ui->lock = $lock;
+    $this->assertTrue($view_ui->isLocked());
+
+    // Set a different lock object with the same object as the mocked account.
+    $lock = (object) array(
+      'owner' => 1,
+      'data' => array(),
+      'updated' => REQUEST_TIME,
+    );
+    $view_ui->lock = $lock;
+    $this->assertFalse($view_ui->isLocked());
+  }
+
 }
