From Alex von Gluck IV <kallisti5@xxxxxxxxxxx>:
Alex von Gluck IV has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/3507 ;)
Change subject: apps/icon-o-matic: Fix null pointer dereference in export window
......................................................................
apps/icon-o-matic: Fix null pointer dereference in export window
* Bailing early in SavePanel constructor is pretty bad and creates
a bunch of NULL pointers things later try and reference.
* This makes it less likely to happen for "extras" like making the
SavePanel pretty.
* An issue still exists where this code isn't able to locate
HScrollBar and VScrollBar for some reason.
Change-Id: Ia80d68508246f952547fb687e29029304a8ffd1e
---
M src/apps/icon-o-matic/gui/SavePanel.cpp
1 file changed, 5 insertions(+), 4 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/07/3507/1
diff --git a/src/apps/icon-o-matic/gui/SavePanel.cpp
b/src/apps/icon-o-matic/gui/SavePanel.cpp
index 18707e3..0d3a801 100644
--- a/src/apps/icon-o-matic/gui/SavePanel.cpp
+++ b/src/apps/icon-o-matic/gui/SavePanel.cpp
@@ -83,10 +83,8 @@
BButton* cancel = dynamic_cast<BButton*>(
background->FindView("cancel button"));
BView* textview = background->FindView("text view");
- BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
- background->FindView("HScrollBar"));
- if (!cancel || !textview || !hscrollbar) {
+ if (!cancel || !textview) {
printf("SavePanel::SavePanel() - couldn't find necessary
controls.\n");
return;
}
@@ -114,7 +112,8 @@
// move up them up the height of the menu field
BView *poseview = background->FindView("PoseView");
if (poseview) poseview->ResizeBy(0, -height);
- BButton *insert = (BButton *)background->FindView("default button");
+ BScrollBar* hscrollbar = dynamic_cast<BScrollBar*>(
+ background->FindView("HScrollBar"));
if (hscrollbar) hscrollbar->MoveBy(0, -height);
BScrollBar *vscrollbar = (BScrollBar
*)background->FindView("VScrollBar");
if (vscrollbar) vscrollbar->ResizeBy(0, -height);
@@ -145,6 +144,8 @@
textview->ResizeTo(fSettingsB->Frame().right - fFormatMF->Frame().left,
textview->Frame().Height());
+ BButton *insert = (BButton *)background->FindView("default button");
+
// Make sure the smallest window won't draw the "Settings" button over
// anything else
float minWindowWidth = textview->Bounds().Width()
--
To view, visit https://review.haiku-os.org/c/haiku/+/3507
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ia80d68508246f952547fb687e29029304a8ffd1e
Gerrit-Change-Number: 3507
Gerrit-PatchSet: 1
Gerrit-Owner: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Gerrit-MessageType: newchange