aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/layout.cc3
-rw-r--r--dw/textblock.hh14
-rw-r--r--dw/widget.cc2
-rw-r--r--dw/widget.hh2
4 files changed, 15 insertions, 6 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index 58b30fb3..542b8ea4 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -308,6 +308,9 @@ Layout::~Layout ()
if (bgImage)
bgImage->unref ();
if (topLevel) {
+ // Sometimes, the toplevel widget does some stuff after the
+ // layout has been deleted.
+ topLevel->layout = NULL;
Widget *w = topLevel;
topLevel = NULL;
delete w;
diff --git a/dw/textblock.hh b/dw/textblock.hh
index e29b93d5..35eea189 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -658,10 +658,16 @@ protected:
{
if (lines->size() == 0)
return 0;
- else
- return
- (words->getRef(lines->getLastRef()->lastWord)->flags &
- (Word::DIV_CHAR_AT_EOL | Word::PERM_DIV_CHAR)) ? 1 : 0;
+ else {
+ Line *line = lines->getLastRef();
+ if (line->firstWord <= line->lastWord)
+ return
+ (words->getRef(line->lastWord)->flags &
+ (Word::DIV_CHAR_AT_EOL | Word::PERM_DIV_CHAR)) ? 1 : 0;
+ else
+ // empty line
+ return 0;
+ }
}
Textblock *getTextblockForLine (Line *line);
diff --git a/dw/widget.cc b/dw/widget.cc
index 8147e3d7..270c5e40 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -106,7 +106,7 @@ Widget::~Widget ()
if (parent)
parent->removeChild (this);
- else
+ else if (layout)
layout->removeWidget ();
DBG_OBJ_DELETE ();
diff --git a/dw/widget.hh b/dw/widget.hh
index 8ebc2767..e7ac7f55 100644
--- a/dw/widget.hh
+++ b/dw/widget.hh
@@ -252,7 +252,7 @@ protected:
{ layout->changeAnchor (this, name, y); }
inline void removeAnchor (char* name)
- { layout->removeAnchor (this, name); }
+ { if (layout) layout->removeAnchor (this, name); }
//inline void updateBgColor () { layout->updateBgColor (); }