Skip to content

Commit

Permalink
Cleanup|Client: Removed unnecessary audience member removals
Browse files Browse the repository at this point in the history
It is no longer necessary to manually remove observers in destructors.
  • Loading branch information
skyjake committed Jun 18, 2016
1 parent aeb3f91 commit e655e65
Show file tree
Hide file tree
Showing 36 changed files with 148 additions and 148 deletions.
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/audio/system.cpp
Expand Up @@ -611,10 +611,10 @@ DENG2_PIMPL(System)
~Instance()
{
sfxClearLogical();
#ifdef __CLIENT__
sfxSampleCache.audienceForSampleRemove() -= this;
DoomsdayApp::app().audienceForGameUnload() -= this;
#endif
//#ifdef __CLIENT__
// sfxSampleCache.audienceForSampleRemove() -= this;
// DoomsdayApp::app().audienceForGameUnload() -= this;
//#endif

theAudioSystem = nullptr;
}
Expand Down
6 changes: 3 additions & 3 deletions doomsday/apps/client/src/busyrunner.cpp
Expand Up @@ -72,9 +72,9 @@ DENG2_PIMPL_NOREF(BusyRunner)

~Instance()
{
busy().audienceForBeginning() -= this;
busy().audienceForEnd() -= this;
busy().audienceForTaskWillStart() -= this;
//busy().audienceForBeginning() -= this;
//busy().audienceForEnd() -= this;
//busy().audienceForTaskWillStart() -= this;

busy().setTaskRunner(nullptr);
}
Expand Down
6 changes: 3 additions & 3 deletions doomsday/apps/client/src/clientapp.cpp
Expand Up @@ -254,9 +254,9 @@ DENG2_PIMPL(ClientApp)
DENG2_ASSERT(!"Unclean shutdown: exception in ~ClientApp");
}

self.audienceForGameChange() -= this;
self.audienceForGameUnload() -= this;
self.audienceForConsoleRegistration() -= this;
//self.audienceForGameChange() -= this;
//self.audienceForGameUnload() -= this;
//self.audienceForConsoleRegistration() -= this;

updater.reset();
//delete infineSys;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/configprofiles.cpp
Expand Up @@ -187,8 +187,8 @@ DENG2_PIMPL(ConfigProfiles)

~Instance()
{
DoomsdayApp::app().audienceForGameUnload() -= this;
DoomsdayApp::app().audienceForGameChange() -= this;
//DoomsdayApp::app().audienceForGameUnload() -= this;
//DoomsdayApp::app().audienceForGameChange() -= this;
}

Profile *addProfile(String const &name)
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/render/environ.cpp
Expand Up @@ -68,7 +68,7 @@ DENG2_PIMPL(Environment)

~Instance()
{
World::get().audienceForMapChange() -= this;
//World::get().audienceForMapChange() -= this;

release();
}
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/client/src/render/rendersystem.cpp
Expand Up @@ -339,11 +339,11 @@ DENG2_PIMPL(RenderSystem)
.define(SReg::FloatCVar, "rend-sky-distance", 1600);
}

~Instance()
{
App::packageLoader().audienceForLoad() -= this;
App::packageLoader().audienceForUnload() -= this;
}
//~Instance()
//{
//App::packageLoader().audienceForLoad() -= this;
//App::packageLoader().audienceForUnload() -= this;
//}

void packageLoaded(String const &packageId)
{
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/resource/materialmanifest.cpp
Expand Up @@ -30,10 +30,10 @@ DENG2_PIMPL_NOREF(MaterialManifest)
materialid_t id = 0; ///< Globally unique identifier.
std::unique_ptr<Material> material; ///< Associated resource (if any).

~Instance()
{
if(material) material->audienceForDeletion() -= this;
}
// ~Instance()
// {
// if(material) material->audienceForDeletion() -= this;
// }

void materialBeingDeleted(Material const &)
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/resource/resourcesystem.cpp
Expand Up @@ -602,7 +602,7 @@ DENG2_PIMPL(ResourceSystem)
{
convertSavegameTasks.waitForDone();

App_Games().audienceForAddition() -= this;
//App_Games().audienceForAddition() -= this;

self.clearAllAnimGroups();
#ifdef __CLIENT__
Expand Down
16 changes: 8 additions & 8 deletions doomsday/apps/client/src/ui/clientwindow.cpp
Expand Up @@ -145,17 +145,17 @@ DENG2_PIMPL(ClientWindow)

~Instance()
{
foreach(String s, configVariableNames())
{
App::config(s).audienceForChange() -= this;
}
// foreach(String s, configVariableNames())
// {
// App::config(s).audienceForChange() -= this;
// }

DoomsdayApp::app().audienceForGameChange() -= this;
App::app().audienceForStartupComplete() -= this;
//DoomsdayApp::app().audienceForGameChange() -= this;
//App::app().audienceForStartupComplete() -= this;
//App_Games().audienceForReadiness() -= this;

self.canvas().audienceForFocusChange() -= this;
self.canvas().audienceForMouseStateChange() -= this;
//self.canvas().audienceForFocusChange() -= this;
//self.canvas().audienceForMouseStateChange() -= this;

releaseRef(cursorX);
releaseRef(cursorY);
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/ui/controllerpresets.cpp
Expand Up @@ -48,10 +48,10 @@ DENG2_PIMPL_NOREF(ControllerPresets)
DoomsdayApp::app().audienceForGameChange() += this;
}

~Instance()
{
DoomsdayApp::app().audienceForGameChange() -= this;
}
// ~Instance()
// {
// DoomsdayApp::app().audienceForGameChange() -= this;
// }

DictionaryValue const &presets() const
{
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/ui/dialogs/alertdialog.cpp
Expand Up @@ -129,10 +129,10 @@ DENG_GUI_PIMPL(AlertDialog)
App::config(VAR_AUTOHIDE).audienceForChange() += this;
}

~Instance()
{
App::config(VAR_AUTOHIDE).audienceForChange() -= this;
}
// ~Instance()
// {
// App::config(VAR_AUTOHIDE).audienceForChange() -= this;
// }

NotificationAreaWidget &notifs()
{
Expand Down
Expand Up @@ -46,10 +46,10 @@ DENG2_PIMPL(ManualConnectionDialog)
ClientApp::serverLink().audienceForDiscoveryUpdate += this;
}

~Instance()
{
ClientApp::serverLink().audienceForDiscoveryUpdate -= this;
}
// ~Instance()
// {
// ClientApp::serverLink().audienceForDiscoveryUpdate -= this;
// }

void linkDiscoveryUpdate(ServerLink const &link)
{
Expand Down
Expand Up @@ -111,7 +111,7 @@ DENG2_OBSERVES(PersistentCanvasWindow, AttributeChange)
menuAspect->useDefaultItems();
}

win.audienceForAttributeChange() -= this;
//win.audienceForAttributeChange() -= this;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/ui/editors/modelasseteditor.cpp
Expand Up @@ -92,10 +92,10 @@ DENG_GUI_PIMPL(ModelAssetEditor)
.setInput(Rule::Top, instLabel->rule().top());
}

~Instance()
{
App::packageLoader().audienceForActivity() -= this;
}
// ~Instance()
// {
// App::packageLoader().audienceForActivity() -= this;
// }

void setOfLoadedPackagesChanged()
{
Expand Down
Expand Up @@ -370,10 +370,10 @@ public VariableGroupEditor::IOwner
partGroup->commit();
}

~Instance()
{
settings.audienceForProfileChange -= this;
}
// ~Instance()
// {
// settings.audienceForProfileChange -= this;
// }

Rule const &firstColumnWidthRule() const
{
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/ui/home/columnwidget.cpp
Expand Up @@ -185,11 +185,11 @@ bool ColumnWidget::dispatchEvent(Event const &event, bool (Widget::*memberFunc)(
{
// Observe mouse clicks occurring in the column.
if (event.type() == Event::MouseButton ||
event.type() == Event::MouseWheel)
event.type() == Event::MouseWheel)
{
MouseEvent const &mouse = event.as<MouseEvent>();
if ((mouse.motion() == MouseEvent::Wheel || mouse.state() == MouseEvent::Pressed) &&
rule().recti().contains(mouse.pos()))
rule().recti().contains(mouse.pos()))
{
emit mouseActivity(this);
}
Expand Down
20 changes: 10 additions & 10 deletions doomsday/apps/client/src/ui/home/gamecolumnwidget.cpp
Expand Up @@ -62,10 +62,10 @@ DENG_GUI_PIMPL(GameColumnWidget)
profile->audienceForDeletion += this;
}

~ProfileItem()
{
if (profile) profile->audienceForDeletion -= this;
}
// ~ProfileItem()
// {
// if (profile) profile->audienceForDeletion -= this;
// }

Game const &game() const
{
Expand Down Expand Up @@ -152,12 +152,12 @@ DENG_GUI_PIMPL(GameColumnWidget)
App::config("home.showUnplayableGames").audienceForChange() += this;
}

~Instance()
{
DoomsdayApp::games().audienceForReadiness() -= this;
DoomsdayApp::gameProfiles().audienceForAddition() -= this;
App::config("home.showUnplayableGames").audienceForChange() -= this;
}
// ~Instance()
// {
// DoomsdayApp::games().audienceForReadiness() -= this;
// DoomsdayApp::gameProfiles().audienceForAddition() -= this;
// App::config("home.showUnplayableGames").audienceForChange() -= this;
// }

ui::Item const *findProfileItem(GameProfile const &profile) const
{
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/ui/home/headerwidget.cpp
Expand Up @@ -54,10 +54,10 @@ DENG_GUI_PIMPL(HeaderWidget)
showDescriptionVar().audienceForChange() += this;
}

~Instance()
{
showDescriptionVar().audienceForChange() -= this;
}
// ~Instance()
// {
// showDescriptionVar().audienceForChange() -= this;
// }

void variableValueChanged(Variable &, Value const &newValue)
{
Expand Down
22 changes: 11 additions & 11 deletions doomsday/apps/client/src/ui/home/homewidget.cpp
Expand Up @@ -148,17 +148,17 @@ DENG_GUI_PIMPL(HomeWidget)

~Instance()
{
for (Column const &col : allColumns)
{
if (col.configVar)
{
col.configVar->audienceForChange() -= this;
}
}

DoomsdayApp::games().audienceForReadiness() -= this;
DoomsdayApp::app().audienceForGameChange() -= this;
DoomsdayApp::app().audienceForGameUnload() -= this;
// for (Column const &col : allColumns)
// {
// if (col.configVar)
// {
// col.configVar->audienceForChange() -= this;
// }
// }

// DoomsdayApp::games().audienceForReadiness() -= this;
// DoomsdayApp::app().audienceForGameChange() -= this;
// DoomsdayApp::app().audienceForGameUnload() -= this;

releaseRef(columnWidth);
releaseRef(scrollOffset);
Expand Down
12 changes: 6 additions & 6 deletions doomsday/apps/client/src/ui/home/multiplayercolumnwidget.cpp
Expand Up @@ -101,12 +101,12 @@ DENG_GUI_PIMPL(MultiplayerColumnWidget)
rule("gap")*/);
}

~Instance()
{
link().audienceForDiscoveryUpdate -= this;
DoomsdayApp::app().audienceForGameChange() -= this;
DoomsdayApp::games().audienceForReadiness() -= this;
}
// ~Instance()
// {
// link().audienceForDiscoveryUpdate -= this;
// DoomsdayApp::app().audienceForGameChange() -= this;
// DoomsdayApp::games().audienceForReadiness() -= this;
// }

void linkDiscoveryUpdate(ServerLink const &link)
{
Expand Down
Expand Up @@ -82,10 +82,10 @@ DENG_GUI_PIMPL(MultiplayerPanelButtonWidget)
self.panel().open();
}

~Instance()
{
DoomsdayApp::games().audienceForReadiness() -= this;
}
// ~Instance()
// {
// DoomsdayApp::games().audienceForReadiness() -= this;
// }

void joinButtonPressed() const
{
Expand Down
8 changes: 4 additions & 4 deletions doomsday/apps/client/src/ui/savedsessionlistdata.cpp
Expand Up @@ -35,10 +35,10 @@ DENG2_PIMPL(SavedSessionListData)
Session::savedIndex().audienceForAvailabilityUpdate() += this;
}

~Instance()
{
Session::savedIndex().audienceForAvailabilityUpdate() -= this;
}
// ~Instance()
// {
// Session::savedIndex().audienceForAvailabilityUpdate() -= this;
// }

void updateFromSavedIndex()
{
Expand Down
14 changes: 7 additions & 7 deletions doomsday/apps/client/src/ui/styledlogsinkformatter.cpp
Expand Up @@ -47,13 +47,13 @@ DENG2_PIMPL(StyledLogSinkFormatter)
}
}

~Instance()
{
if(observe)
{
App::config()[VAR_METADATA].audienceForChange() -= this;
}
}
// ~Instance()
// {
// if(observe)
// {
// App::config()[VAR_METADATA].audienceForChange() -= this;
// }
// }

void variableValueChanged(Variable &, Value const &newValue)
{
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/client/src/ui/widgets/consolecommandwidget.cpp
Expand Up @@ -38,11 +38,11 @@ DENG2_OBSERVES(DoomsdayApp, GameChange)
DoomsdayApp::app().audienceForGameChange() += this;
}

~Instance()
{
App::app().audienceForStartupComplete() -= this;
DoomsdayApp::app().audienceForGameChange() -= this;
}
// ~Instance()
// {
// App::app().audienceForStartupComplete() -= this;
// DoomsdayApp::app().audienceForGameChange() -= this;
// }

void appStartupCompleted()
{
Expand Down

0 comments on commit e655e65

Please sign in to comment.