[BUG] Updating TheWorldMainDockingBar leaves dangling results widgets

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[BUG] Updating TheWorldMainDockingBar leaves dangling results widgets

Christoph Thiede

Steps to reproduce:

Go to the SearchBar of TWMDB (TheWorldMainDockingBar) and print something.

Update TWMBB, for example by applying a UI theme.

In the SearchBar, print another thing.


Expected behavior:

There is still one results widget displaying the result of your latest expression.


Actual behavior:

The first results widget keeps open and will be never closed.


Considerations:

SearchBar, which is a model, stores the results widget, which is a morph. Via #removeResultsWidget, the latter is removed if a new expression is printed.

But in TWMDB>>#searchBarOn:, which is called by #updatedIfNeeded:, each time a new SearchBar is created and built. This SearchBar is not referenced by TWMDB or the DockingBarMorph, but only as the model of the PluggableTextMorphPlus for the search bar. This text morph, in turn, is deleted by #updateIfNeeded: per "aDockingBar removeAllMorphs". But as the text morph is directly composed into the world, it is not affected by that deletion.


Solution approaches:

a. Store the SearchBar model instance in TWMDB? Contra: TWMDB should keep able to work with an arbitrary number of docking bar morphs.

b. Store the SearchBar model instance in DockingBarMorph? Contra: handling the search rather seems a responsibility of TWMDB.

I am a bit confused about the current design ...


Best,

Christoph



Carpe Squeak!