Browse Source

Fix after moving to non-JQuery Web.

#empty (and #contents:) do not remove
events, so bubbled events may occur.

Guarded TabManager >> selectTab:
not to reactivate removed tab via bubbled event.
Herby Vojčík 5 years ago
parent
commit
28d47ec271
2 changed files with 14 additions and 3 deletions
  1. 12 3
      src/IDE.js
  2. 2 0
      src/IDE.st

+ 12 - 3
src/IDE.js

@@ -1991,6 +1991,15 @@ var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
+var $2,$1;
+$2=$self._tabs();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+$ctx1.sendIdx["tabs"]=1;
+//>>excludeEnd("ctx");
+$1=$recv($2)._includes_(aWidget);
+if(!$core.assert($1)){
+return self;
+}
 $self._open();
 $self.selectedTab=aWidget;
 $recv($self._tabs())._do_((function(each){
@@ -1999,7 +2008,7 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 return $recv(each)._hide();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
 //>>excludeEnd("ctx");
 }));
 $recv(aWidget)._show();
@@ -2011,11 +2020,11 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aWidget"],
-source: "selectTab: aWidget\x0a\x09self open.\x0a\x09selectedTab := aWidget.\x0a\x09self tabs do: [ :each |\x0a\x09each hide ].\x0a\x09aWidget show.\x0a\x09\x0a\x09self update",
+source: "selectTab: aWidget\x0a\x09(self tabs includes: aWidget) ifFalse: [ ^ self ].\x0a\x0a\x09self open.\x0a\x09selectedTab := aWidget.\x0a\x09self tabs do: [ :each |\x0a\x09each hide ].\x0a\x09aWidget show.\x0a\x09\x0a\x09self update",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["open", "do:", "tabs", "hide", "show", "update"]
+messageSends: ["ifFalse:", "includes:", "tabs", "open", "do:", "hide", "show", "update"]
 }),
 $globals.TabManager);
 

+ 2 - 0
src/IDE.st

@@ -350,6 +350,8 @@ search: aString
 !
 
 selectTab: aWidget
+	(self tabs includes: aWidget) ifFalse: [ ^ self ].
+
 	self open.
 	selectedTab := aWidget.
 	self tabs do: [ :each |