From 7df553e6f339e2f3ee9a92e4e435d1e4d17c1e19 Mon Sep 17 00:00:00 2001 From: Matthew Wilber Date: Mon, 15 Nov 2004 23:57:45 +0000 Subject: [PATCH] Removed unnessecary BView creation, added code to check for the initial, "no config view yet" state git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9971 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../datatranslations/DataTranslationsWindow.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/prefs/datatranslations/DataTranslationsWindow.cpp b/src/prefs/datatranslations/DataTranslationsWindow.cpp index d610ef854b..e247db2a29 100644 --- a/src/prefs/datatranslations/DataTranslationsWindow.cpp +++ b/src/prefs/datatranslations/DataTranslationsWindow.cpp @@ -124,7 +124,10 @@ DataTranslationsWindow::ShowConfigView(int32 id) if (id >= num_translators) return B_BAD_VALUE; - fRightBox->RemoveChild(fConfigView); + // fConfigView is NULL the first time this function + // is called, prevent a segment fault + if (fConfigView) + fRightBox->RemoveChild(fConfigView); BMessage emptyMsg; BRect rect(0, 0, 200, 233); status_t ret = roster->MakeConfigurationView(tid, &emptyMsg, &fConfigView, &rect); @@ -159,6 +162,10 @@ DataTranslationsWindow::ShowConfigView(int32 id) void DataTranslationsWindow::SetupViews() { + fConfigView = NULL; + // This is NULL until a translator is + // selected from the listview + // Window box BBox *mainBox = new BBox(BRect(0, 0, DTW_RIGHT, DTW_BOTTOM), "All_Window", B_FOLLOW_ALL_SIDES, @@ -194,13 +201,6 @@ DataTranslationsWindow::SetupViews() B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); fRightBox->AddChild(fTranNameView); - // Add the translator config panel - BRect configRect(rightRect); - configRect.bottom = iconRect.top; - fConfigView = new BView(configRect, "ConfigPanel", B_FOLLOW_ALL_SIDES, - B_WILL_DRAW | B_FRAME_EVENTS); - fRightBox->AddChild(fConfigView); - // Add the translators list view fTranListView = new DataTranslationsView(BRect(10, 10, 120, 288), "TransList", B_SINGLE_SELECTION_LIST);