MAINT-3555 crash in LLPanel::~LLPanel() on shutdown:

- memory leaks fixing;
master
maksymsproductengine 2014-02-05 20:45:09 +02:00
parent 52ce788d0c
commit 1033c9d67f
45 changed files with 94 additions and 95 deletions

View File

@ -207,6 +207,10 @@ namespace {
#endif
}
namespace LLError
{
void clean();
}
namespace
{
@ -352,7 +356,11 @@ namespace
Globals()
: messageStreamInUse(false)
{ }
~Globals()
{
LLError::clean();
}
};
void Globals::addCallSite(LLError::CallSite& site)
@ -380,8 +388,9 @@ namespace
is.
See C++ FAQ Lite, sections 10.12 through 10.14
*/
static Globals* globals = new Globals;
return *globals;
static Globals globals;
return globals;
}
}
@ -415,6 +424,7 @@ namespace LLError
static void reset();
static Settings* saveAndReset();
static void restore(Settings*);
static void clean();
private:
Settings()
@ -446,6 +456,15 @@ namespace LLError
}
return *p;
}
void Settings::clean()
{
Globals::get().invalidateCallSites();
Settings*& p = getPtr();
delete p;
p = NULL;
}
void Settings::reset()
{
@ -480,10 +499,7 @@ namespace LLError
static Settings* currentSettings = NULL;
return currentSettings;
}
}
namespace LLError
{
CallSite::CallSite(ELevel level,
const char* file,
int line,
@ -721,11 +737,7 @@ namespace LLError
setLevels(s.tagLevelMap, entry["tags"], level);
}
}
}
namespace LLError
{
Recorder::~Recorder()
{ }
@ -756,18 +768,26 @@ namespace LLError
std::remove(s.recorders.begin(), s.recorders.end(), recorder),
s.recorders.end());
}
}
namespace LLError
{
void deleteRecorder(LLError::Settings& settings)
{
removeRecorder(settings.fileRecorder);
delete settings.fileRecorder;
settings.fileRecorder = NULL;
settings.fileRecorderFileName.clear();
}
void clean()
{
deleteRecorder(LLError::Settings::get());
LLError::Settings::clean();
}
void logToFile(const std::string& file_name)
{
LLError::Settings& s = LLError::Settings::get();
removeRecorder(s.fileRecorder);
delete s.fileRecorder;
s.fileRecorder = NULL;
s.fileRecorderFileName.clear();
deleteRecorder(s);
if (file_name.empty())
{
@ -839,8 +859,6 @@ namespace
}
}
}
}
/*
Recorder formats:
@ -870,7 +888,6 @@ You get:
*/
namespace {
bool checkLevelMap(const LevelMap& map, const std::string& key,
LLError::ELevel& level)
{
@ -1127,13 +1144,7 @@ namespace LLError
s.crashFunction(message);
}
}
}
namespace LLError
{
Settings* saveAndResetSettings()
{
return Settings::saveAndReset();
@ -1226,10 +1237,7 @@ namespace LLError
return chars ? time_str : "time error";
}
}
namespace LLError
{
char** LLCallStacks::sBuffer = NULL ;
S32 LLCallStacks::sIndex = 0 ;

View File

@ -44,7 +44,7 @@
#include "llsdserialize.h"
#include "llproxy.h"
LLPumpIO* gServicePump;
LLPumpIO* gServicePump = NULL;
BOOL gBreak = false;
BOOL gSent = false;
@ -80,7 +80,8 @@ LLCrashLogger::LLCrashLogger() :
LLCrashLogger::~LLCrashLogger()
{
delete gServicePump;
gServicePump = NULL;
}
// TRIM_SIZE must remain larger than LINE_SEARCH_SIZE.

View File

@ -38,7 +38,7 @@ namespace
{
typedef std::map<LLHost, LLHTTPSender*> SenderMap;
static SenderMap senderMap;
static LLHTTPSender* defaultSender = new LLHTTPSender();
static LLPointer<LLHTTPSender> defaultSender(new LLHTTPSender());
}
//virtual
@ -90,6 +90,5 @@ void LLHTTPSender::clearSender(const LLHost& host)
//static
void LLHTTPSender::setDefaultSender(LLHTTPSender* sender)
{
delete defaultSender;
defaultSender = sender;
}

View File

@ -32,7 +32,7 @@
class LLHost;
class LLSD;
class LLHTTPSender
class LLHTTPSender : public LLThreadSafeRefCount
{
public:

View File

@ -330,17 +330,16 @@ private:
// local static instance for registering a particular panel class
template<typename T>
class LLRegisterPanelClassWrapper
: public LLRegisterPanelClass
class LLPanelInjector
{
public:
// reigister with either the provided builder, or the generic templated builder
LLRegisterPanelClassWrapper(const std::string& tag);
// register with either the provided builder, or the generic templated builder
LLPanelInjector(const std::string& tag);
};
template<typename T>
LLRegisterPanelClassWrapper<T>::LLRegisterPanelClassWrapper(const std::string& tag)
LLPanelInjector<T>::LLPanelInjector(const std::string& tag)
{
LLRegisterPanelClass::instance().addPanelClass(tag,&LLRegisterPanelClass::defaultPanelClassBuilder<T>);
}

View File

@ -200,14 +200,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
#ifdef INCLUDE_VLD
// only works for debug builds (hard coded into vld.h)
#ifdef _DEBUG
// start with Visual Leak Detector turned off
VLDGlobalDisable();
#endif // _DEBUG
#endif // INCLUDE_VLD
const S32 MAX_HEAPS = 255;
DWORD heap_enable_lfh_error[MAX_HEAPS];
S32 num_heaps = 0;

View File

@ -43,7 +43,7 @@
#include "llpaneloutfitedit.h"
#include "lltrans.h"
static LLRegisterPanelClassWrapper<LLCOFWearables> t_cof_wearables("cof_wearables");
static LLPanelInjector<LLCOFWearables> t_cof_wearables("cof_wearables");
const LLSD REARRANGE = LLSD().with("rearrange", LLSD());

View File

@ -151,7 +151,7 @@ void LLPanelCameraItem::setValue(const LLSD& value)
getChildView("selected_picture")->setVisible( value["selected"]);
}
static LLRegisterPanelClassWrapper<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel");
static LLPanelInjector<LLPanelCameraZoom> t_camera_zoom_panel("camera_zoom_panel");
//-------------------------------------------------------------------------------
// LLPanelCameraZoom

View File

@ -1823,7 +1823,7 @@ private:
callback_t mCallback;
};
//----------------------------------------------------------------------------
static LLRegisterPanelClassWrapper<LLPanelPreference> t_places("panel_preference");
static LLPanelInjector<LLPanelPreference> t_places("panel_preference");
LLPanelPreference::LLPanelPreference()
: LLPanel(),
mBandWidthUpdater(NULL)
@ -2063,8 +2063,8 @@ private:
std::list<std::string> mAccountIndependentSettings;
};
static LLRegisterPanelClassWrapper<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
static LLRegisterPanelClassWrapper<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
static LLPanelInjector<LLPanelPreferenceGraphics> t_pref_graph("panel_preference_graphics");
static LLPanelInjector<LLPanelPreferencePrivacy> t_pref_privacy("panel_preference_privacy");
BOOL LLPanelPreferenceGraphics::postBuild()
{

View File

@ -47,10 +47,10 @@
#include "llviewercontrol.h"
#include "llviewermedia.h"
static LLRegisterPanelClassWrapper<LLSocialStatusPanel> t_panel_status("llsocialstatuspanel");
static LLRegisterPanelClassWrapper<LLSocialPhotoPanel> t_panel_photo("llsocialphotopanel");
static LLRegisterPanelClassWrapper<LLSocialCheckinPanel> t_panel_checkin("llsocialcheckinpanel");
static LLRegisterPanelClassWrapper<LLSocialAccountPanel> t_panel_account("llsocialaccountpanel");
static LLPanelInjector<LLSocialStatusPanel> t_panel_status("llsocialstatuspanel");
static LLPanelInjector<LLSocialPhotoPanel> t_panel_photo("llsocialphotopanel");
static LLPanelInjector<LLSocialCheckinPanel> t_panel_checkin("llsocialcheckinpanel");
static LLPanelInjector<LLSocialAccountPanel> t_panel_account("llsocialaccountpanel");
const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/";

View File

@ -343,7 +343,7 @@ private:
//////////////////////////////////////////////////////////////////////////
static LLRegisterPanelClassWrapper<LLOutfitsList> t_outfits_list("outfits_list");
static LLPanelInjector<LLOutfitsList> t_outfits_list("outfits_list");
LLOutfitsList::LLOutfitsList()
: LLPanelAppearanceTab()

View File

@ -48,7 +48,7 @@
#include "llsidetraypanelcontainer.h"
#include "llviewercontrol.h"
static LLRegisterPanelClassWrapper<LLPanelBlockedList> t_panel_blocked_list("panel_block_list_sidetray");
static LLPanelInjector<LLPanelBlockedList> t_panel_blocked_list("panel_block_list_sidetray");
//
// Constants

View File

@ -62,7 +62,7 @@
#include "llappearancemgr.h"
// register panel with appropriate XML
static LLRegisterPanelClassWrapper<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
static LLPanelInjector<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
// subparts of the UI for focus, camera position, etc.
enum ESubpart {

View File

@ -56,7 +56,7 @@
#include "lltrans.h"
static LLRegisterPanelClassWrapper<LLPanelGroup> t_panel_group("panel_group_info_sidetray");
static LLPanelInjector<LLPanelGroup> t_panel_group("panel_group_info_sidetray");

View File

@ -53,7 +53,7 @@
#include "lltrans.h"
#include "llviewerwindow.h"
static LLRegisterPanelClassWrapper<LLPanelGroupGeneral> t_panel_group_general("panel_group_general");
static LLPanelInjector<LLPanelGroupGeneral> t_panel_group_general("panel_group_general");
// consts
const S32 MATURE_CONTENT = 1;

View File

@ -55,7 +55,7 @@
#include "llfloaterworldmap.h"
#include "llviewermessage.h"
static LLRegisterPanelClassWrapper<LLPanelGroupLandMoney> t_panel_group_money("panel_group_land_money");
static LLPanelInjector<LLPanelGroupLandMoney> t_panel_group_money("panel_group_land_money");

View File

@ -57,7 +57,7 @@
#include "llnotificationsutil.h"
#include "llgiveinventory.h"
static LLRegisterPanelClassWrapper<LLPanelGroupNotices> t_panel_group_notices("panel_group_notices");
static LLPanelInjector<LLPanelGroupNotices> t_panel_group_notices("panel_group_notices");
/////////////////////////

View File

@ -55,7 +55,7 @@
#include "roles_constants.h"
static LLRegisterPanelClassWrapper<LLPanelGroupRoles> t_panel_group_roles("panel_group_roles");
static LLPanelInjector<LLPanelGroupRoles> t_panel_group_roles("panel_group_roles");
bool agentCanRemoveFromRole(const LLUUID& group_id,
const LLUUID& role_id)
@ -733,7 +733,7 @@ void LLPanelGroupSubTab::setFooterEnabled(BOOL enable)
////////////////////////////
static LLRegisterPanelClassWrapper<LLPanelGroupMembersSubTab> t_panel_group_members_subtab("panel_group_members_subtab");
static LLPanelInjector<LLPanelGroupMembersSubTab> t_panel_group_members_subtab("panel_group_members_subtab");
LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab()
: LLPanelGroupSubTab(),
@ -1755,7 +1755,7 @@ void LLPanelGroupMembersSubTab::updateMembers()
// LLPanelGroupRolesSubTab
////////////////////////////
static LLRegisterPanelClassWrapper<LLPanelGroupRolesSubTab> t_panel_group_roles_subtab("panel_group_roles_subtab");
static LLPanelInjector<LLPanelGroupRolesSubTab> t_panel_group_roles_subtab("panel_group_roles_subtab");
LLPanelGroupRolesSubTab::LLPanelGroupRolesSubTab()
: LLPanelGroupSubTab(),
@ -2469,7 +2469,7 @@ void LLPanelGroupRolesSubTab::saveRoleChanges(bool select_saved_role)
// LLPanelGroupActionsSubTab
////////////////////////////
static LLRegisterPanelClassWrapper<LLPanelGroupActionsSubTab> t_panel_group_actions_subtab("panel_group_actions_subtab");
static LLPanelInjector<LLPanelGroupActionsSubTab> t_panel_group_actions_subtab("panel_group_actions_subtab");
LLPanelGroupActionsSubTab::LLPanelGroupActionsSubTab()

View File

@ -31,7 +31,7 @@
#include "llmediactrl.h"
#include "llviewerhome.h"
static LLRegisterPanelClassWrapper<LLPanelHome> t_home("panel_sidetray_home");
static LLPanelInjector<LLPanelHome> t_home("panel_sidetray_home");
LLPanelHome::LLPanelHome() :
LLPanel(),

View File

@ -53,7 +53,7 @@ typedef std::pair<LLUUID, std::string> folder_pair_t;
static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right);
static void collectLandmarkFolders(LLInventoryModel::cat_array_t& cats);
static LLRegisterPanelClassWrapper<LLPanelLandmarkInfo> t_landmark_info("panel_landmark_info");
static LLPanelInjector<LLPanelLandmarkInfo> t_landmark_info("panel_landmark_info");
// Statics for textures filenames
static std::string icon_pg;

View File

@ -58,7 +58,7 @@
const std::string FILTERS_FILENAME("filters.xml");
static LLRegisterPanelClassWrapper<LLPanelMainInventory> t_inventory("panel_main_inventory");
static LLPanelInjector<LLPanelMainInventory> t_inventory("panel_main_inventory");
void on_file_loaded_for_save(BOOL success,
LLViewerFetchedTexture *src_vi,

View File

@ -38,7 +38,7 @@
#include "llviewercontrol.h"
static LLRegisterPanelClassWrapper<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
static LLPanelInjector<LLPanelMarketplaceInbox> t_panel_marketplace_inbox("panel_marketplace_inbox");
const LLPanelMarketplaceInbox::Params& LLPanelMarketplaceInbox::getDefaultParams()
{

View File

@ -48,7 +48,7 @@
#include "lltabcontainer.h"
#include "lltexturectrl.h"
static LLRegisterPanelClassWrapper<LLPanelMe> t_panel_me_profile("panel_me");
static LLPanelInjector<LLPanelMe> t_panel_me_profile("panel_me");
LLPanelMe::LLPanelMe(void)
: LLPanelProfile()

View File

@ -74,7 +74,7 @@
#include "llwearabletype.h"
#include "llweb.h"
static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
static LLPanelInjector<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);
const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);

View File

@ -46,7 +46,7 @@
static const std::string OUTFITS_TAB_NAME = "outfitslist_tab";
static const std::string COF_TAB_NAME = "cof_tab";
static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
static LLPanelInjector<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
mMyOutfitsPanel(NULL),

View File

@ -216,7 +216,7 @@ static const LLAvatarItemStatusComparator STATUS_COMPARATOR;
static LLAvatarItemDistanceComparator DISTANCE_COMPARATOR;
static const LLAvatarItemRecentSpeakerComparator RECENT_SPEAKER_COMPARATOR;
static LLRegisterPanelClassWrapper<LLPanelPeople> t_people("panel_people");
static LLPanelInjector<LLPanelPeople> t_people("panel_people");
//=============================================================================

View File

@ -69,7 +69,7 @@ static const std::string CLASSIFIED_ID("classified_id");
static const std::string CLASSIFIED_NAME("classified_name");
static LLRegisterPanelClassWrapper<LLPanelPicks> t_panel_picks("panel_picks");
static LLPanelInjector<LLPanelPicks> t_panel_picks("panel_picks");
class LLPickHandler : public LLCommandHandler,

View File

@ -53,7 +53,7 @@
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
static LLRegisterPanelClassWrapper<LLPanelPlaceProfile> t_place_profile("panel_place_profile");
static LLPanelInjector<LLPanelPlaceProfile> t_place_profile("panel_place_profile");
// Statics for textures filenames
static std::string icon_pg;

View File

@ -229,7 +229,7 @@ private:
};
static LLRegisterPanelClassWrapper<LLPanelPlaces> t_places("panel_places");
static LLPanelInjector<LLPanelPlaces> t_places("panel_places");
LLPanelPlaces::LLPanelPlaces()
: LLPanel(),

View File

@ -60,7 +60,7 @@ private:
void onSend();
};
static LLRegisterPanelClassWrapper<LLPanelSnapshotInventory> panel_class("llpanelsnapshotinventory");
static LLPanelInjector<LLPanelSnapshotInventory> panel_class("llpanelsnapshotinventory");
LLPanelSnapshotInventory::LLPanelSnapshotInventory()
{

View File

@ -63,7 +63,7 @@ private:
void onSaveFlyoutCommit(LLUICtrl* ctrl);
};
static LLRegisterPanelClassWrapper<LLPanelSnapshotLocal> panel_class("llpanelsnapshotlocal");
static LLPanelInjector<LLPanelSnapshotLocal> panel_class("llpanelsnapshotlocal");
LLPanelSnapshotLocal::LLPanelSnapshotLocal()
{

View File

@ -56,7 +56,7 @@ private:
void onSaveToComputer();
};
static LLRegisterPanelClassWrapper<LLPanelSnapshotOptions> panel_class("llpanelsnapshotoptions");
static LLPanelInjector<LLPanelSnapshotOptions> panel_class("llpanelsnapshotoptions");
LLPanelSnapshotOptions::LLPanelSnapshotOptions()
{

View File

@ -79,7 +79,7 @@ private:
std::string mAgentEmail;
};
static LLRegisterPanelClassWrapper<LLPanelSnapshotPostcard> panel_class("llpanelsnapshotpostcard");
static LLPanelInjector<LLPanelSnapshotPostcard> panel_class("llpanelsnapshotpostcard");
LLPanelSnapshotPostcard::LLPanelSnapshotPostcard()
: mHasFirstMsgFocus(false)

View File

@ -64,7 +64,7 @@ private:
void onSend();
};
static LLRegisterPanelClassWrapper<LLPanelSnapshotProfile> panel_class("llpanelsnapshotprofile");
static LLPanelInjector<LLPanelSnapshotProfile> panel_class("llpanelsnapshotprofile");
LLPanelSnapshotProfile::LLPanelSnapshotProfile()
{

View File

@ -40,7 +40,7 @@
#include "lluictrlfactory.h"
static LLRegisterPanelClassWrapper<LLPanelVoiceDeviceSettings> t_panel_group_general("panel_voice_device_settings");
static LLPanelInjector<LLPanelVoiceDeviceSettings> t_panel_group_general("panel_voice_device_settings");
static const std::string DEFAULT_DEVICE("Default");

View File

@ -36,7 +36,7 @@
#include "lltransientfloatermgr.h"
#include "llvoiceclient.h"
static LLRegisterPanelClassWrapper<LLPanelVoiceEffect> t_panel_voice_effect("panel_voice_effect");
static LLPanelInjector<LLPanelVoiceEffect> t_panel_voice_effect("panel_voice_effect");
LLPanelVoiceEffect::LLPanelVoiceEffect()
: mVoiceEffectCombo(NULL)

View File

@ -151,7 +151,7 @@ protected:
std::string LLPanelAppearanceTab::sFilterSubString = LLStringUtil::null;
static LLRegisterPanelClassWrapper<LLPanelWearing> t_panel_wearing("panel_wearing");
static LLPanelInjector<LLPanelWearing> t_panel_wearing("panel_wearing");
LLPanelWearing::LLPanelWearing()
: LLPanelAppearanceTab()

View File

@ -27,7 +27,7 @@
#include "llpopupview.h"
static LLRegisterPanelClassWrapper<LLPopupView> r("popup_holder");
static LLPanelInjector<LLPopupView> r("popup_holder");
bool view_visible_and_enabled(LLView* viewp)
{

View File

@ -59,7 +59,7 @@ S32 gStartImageWidth = 1;
S32 gStartImageHeight = 1;
const F32 FADE_TO_WORLD_TIME = 1.0f;
static LLRegisterPanelClassWrapper<LLProgressView> r("progress_view");
static LLPanelInjector<LLProgressView> r("progress_view");
// XUI: Translate
LLProgressView::LLProgressView()

View File

@ -49,7 +49,7 @@
#include "llvoavatarself.h"
#include "llviewerwearable.h"
static LLRegisterPanelClassWrapper<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
static LLPanelInjector<LLSidepanelAppearance> t_appearance("sidepanel_appearance");
class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver
{

View File

@ -59,7 +59,7 @@
#include "llviewernetwork.h"
#include "llweb.h"
static LLRegisterPanelClassWrapper<LLSidepanelInventory> t_inventory("sidepanel_inventory");
static LLPanelInjector<LLSidepanelInventory> t_inventory("sidepanel_inventory");
//
// Constants

View File

@ -127,7 +127,7 @@ void LLObjectInventoryObserver::inventoryChanged(LLViewerObject* object,
/// Class LLSidepanelItemInfo
///----------------------------------------------------------------------------
static LLRegisterPanelClassWrapper<LLSidepanelItemInfo> t_item_info("sidepanel_item_info");
static LLPanelInjector<LLSidepanelItemInfo> t_item_info("sidepanel_item_info");
// Default constructor
LLSidepanelItemInfo::LLSidepanelItemInfo(const LLPanel::Params& p)

View File

@ -71,7 +71,7 @@
LLSidepanelTaskInfo* LLSidepanelTaskInfo::sActivePanel = NULL;
static LLRegisterPanelClassWrapper<LLSidepanelTaskInfo> t_task_info("sidepanel_task_info");
static LLPanelInjector<LLSidepanelTaskInfo> t_task_info("sidepanel_task_info");
// Default constructor
LLSidepanelTaskInfo::LLSidepanelTaskInfo()

View File

@ -39,7 +39,7 @@ class LLView;
class LLPanel;
class LLTool
: public LLMouseHandler
: public LLMouseHandler, public LLThreadSafeRefCount
{
public:
LLTool( const std::string& name, LLToolComposite* composite = NULL );

View File

@ -61,7 +61,7 @@ extern LLControlGroup gSavedSettings;
// we use this in various places instead of NULL
static LLTool* sNullTool = new LLTool(std::string("null"), NULL);
static LLPointer<LLTool> sNullTool(new LLTool(std::string("null"), NULL));
//-----------------------------------------------------------------------
// LLToolComposite