Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/lib


Modified Files:
        ewl_text.c 


Log Message:
- correctly handling setting a formatting node before any text has been set

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_text.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -3 -r1.150 -r1.151
--- ewl_text.c  6 Jan 2007 10:11:25 -0000       1.150
+++ ewl_text.c  6 Jan 2007 12:00:17 -0000       1.151
@@ -3848,7 +3848,7 @@
 ewl_text_current_fmt_set(Ewl_Text *t, unsigned int context_mask, 
                                Ewl_Text_Context *change)
 {
-       Ewl_Text_Context *old, *new;
+       Ewl_Text_Context *old = NULL, *new;
 
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("t", t);
@@ -3865,12 +3865,20 @@
                Ewl_Text_Fmt *fmt;
 
                fmt = ecore_dlist_current(t->formatting.nodes);
-               old = fmt->tx;
+               if (fmt) old = fmt->tx;
        }
 
-       new = ewl_text_context_find(old, context_mask, change);
-       if (t->formatting.current.tx)
-               ewl_text_context_release(t->formatting.current.tx);
+       /* If there is no old context then we use the default context. This
+        * can happen if you're changing the text settings (font, colour,
+        * etc) before any text was inserted into the widget */
+       if (old)
+       {
+               new = ewl_text_context_find(old, context_mask, change);
+               if (t->formatting.current.tx)
+                       ewl_text_context_release(t->formatting.current.tx);
+       }
+       else
+               new = ewl_text_context_default_create(t);
 
        t->formatting.current.tx = new;
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to