]> O.S.I.I.S - jp/crow.git/commitdiff
debug when vc of ds newVal is null
authorjpbruyere <jp.bruyere@hotmail.com>
Sun, 1 Jan 2017 18:59:28 +0000 (19:59 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sun, 1 Jan 2017 18:59:28 +0000 (19:59 +0100)
Tests/BasicTests.cs
Tests/Interfaces/TemplatedContainer/test_Listbox.crow
src/CompilerServices/CompilerServices.cs
src/GraphicObjects/TemplatedGroup.cs

index 1ae9094f318bc8040be6e0fb9987be817e2c8c45..0533729dff8847529de6be145d1bae5dff191bec 100644 (file)
@@ -129,6 +129,8 @@ namespace Tests
                        //testFiles = new string [] { @"Interfaces/Unsorted/testFileDialog.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
                        testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
+                       //testFiles = new string [] { @"Interfaces/TemplatedContainer/test_Listbox.crow" };
+                       //testFiles = new string [] { @"Interfaces/TemplatedControl/testItemTemplateTag.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/test2WayBinding.crow" };
                        //testFiles = new string [] { @"Interfaces/Divers/testPropLess.crow" };
                        testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
index e24b399db94ccf5fdefbabedbee50cbe77597c7c..47adb8ceb1396f024ce2f1c91c53a6b845a9fbf9 100755 (executable)
@@ -5,9 +5,9 @@
                <Label Text="{../ColorList.SelectedItem}" Background="DarkGreen"/>
                <Label Text="{Hover}" Background="DarkGreen"/>
                <Button Caption="Clear" Width="Stretched" MouseClick="OnClear"/>
-<!--           <ListBox Name="ColorList" Data="{TestList}"  Width="200" Height="200" 
+               <ListBox Name="ColorList" Data="{TestList}"  Width="200" Height="200" 
                                         ItemTemplate="#Tests.Interfaces.colorItem.crow">                       
                </ListBox>
-               <Button Caption="Load list" Width="Stretched" MouseClick="OnLoadList"/>-->
+               <Button Caption="Load list" Width="Stretched" MouseClick="OnLoadList"/>
        </VerticalStack>
 </Border>
\ No newline at end of file
index c0acc5d5d425511836f8dda591f8f1bd46c99e42..42ae5f7b3856c707611b203456e2e58f945672df 100644 (file)
@@ -456,7 +456,14 @@ namespace Crow
                        il.MarkLabel (convert);
 
                        if (dstType == typeof(string)) {
+                               System.Reflection.Emit.Label emitNullStr = il.DefineLabel ();
+                               il.Emit (OpCodes.Dup);
+                               il.Emit (OpCodes.Brfalse, emitNullStr);
                                il.Emit (OpCodes.Callvirt, CompilerServices.miObjToString);
+                               il.Emit (OpCodes.Br, endConvert);
+                               il.MarkLabel (emitNullStr);
+                               il.Emit (OpCodes.Pop);//remove null string from stack
+                               il.Emit (OpCodes.Ldstr, "");//replace with empty string
                        } else if (dstType.IsPrimitive) {
                                //il.Emit (OpCodes.Unbox_Any, dstType);
                                il.Emit (OpCodes.Callvirt, CompilerServices.GetConvertMethod (dstType));
@@ -464,7 +471,10 @@ namespace Crow
                                il.Emit (OpCodes.Unbox_Any, dstType);
                        } else{
                                il.Emit (OpCodes.Stloc_0); //save orig value in loc0
+                               //first check if not null
                                il.Emit (OpCodes.Ldloc_0);
+                               il.Emit (OpCodes.Dup);
+                               il.Emit (OpCodes.Brfalse, endConvert);
                                il.Emit (OpCodes.Callvirt, miGetType);
                                il.Emit (OpCodes.Ldtoken, dstType);//push destination property type for testing
                                il.Emit (OpCodes.Call, CompilerServices.miGetTypeFromHandle);
index 3c1fed9e976ea8e730444878ebb2f07e55e0c1d9..b05aad9fa732a5cd57b5fd23d24f84268ebb726b 100644 (file)
@@ -135,7 +135,7 @@ namespace Crow
 
                                NotifyValueChanged ("Data", data);
 
-                               //lock (CurrentInterface.UpdateMutex)
+                               lock (CurrentInterface.UpdateMutex)
                                        ClearItems ();
 
                                if (data == null)