ilmClient: fix for ilm_getPropertiesOfScreen if screen was not found
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Fri, 18 Jan 2013 12:08:28 +0000 (04:08 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Tue, 5 Feb 2013 13:20:04 +0000 (05:20 -0800)
if the scene does not contain the requested screen, the screenProperties
structure is now initialized to save values.

LayerManagerControl now correctly evaluates the return value of
ilm_getPropertiesOfScreen and prints "screen not found" instead of
crashing.

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
LayerManagerClient/ilmClient/src/generic_ilm_client.c
LayerManagerControl/src/print.cpp

index e337960..35a5020 100644 (file)
@@ -1961,6 +1961,15 @@ ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreen
     {
         returnValue = ILM_SUCCESS;
     }
+    else
+    {
+        pScreenProperties->layerCount = 0;
+        pScreenProperties->harwareLayerCount = 0;
+        pScreenProperties->layerIds = NULL;
+        pScreenProperties->screenWidth = 0;
+        pScreenProperties->screenHeight = 0;
+    }
+
     gIpcModule.destroyMessage(response);
     gIpcModule.destroyMessage(command);
     return returnValue;
index c41e0ef..1e10574 100644 (file)
@@ -85,20 +85,27 @@ void printScreenProperties(unsigned int screenid, const char* prefix)
     cout << prefix << "---------------------------------------\n";
 
     ilmScreenProperties screenProperties;
-    ilm_getPropertiesOfScreen(screenid, &screenProperties);
-    cout << prefix << "- resolution:           x=" << screenProperties.screenWidth << ", y="
-            << screenProperties.screenHeight << "\n";
+    if (ilm_getPropertiesOfScreen(screenid, &screenProperties) == ILM_SUCCESS)
+    {
+        cout << prefix << "- resolution:           x=" << screenProperties.screenWidth << ", y="
+                << screenProperties.screenHeight << "\n";
 
-    cout << prefix << "- hardware layer count: " << screenProperties.harwareLayerCount << "\n";
+        cout << prefix << "- hardware layer count: " << screenProperties.harwareLayerCount << "\n";
 
-    cout << prefix << "- layer render order:   ";
+        cout << prefix << "- layer render order:   ";
 
-    for (t_ilm_uint layerIndex = 0; layerIndex < screenProperties.layerCount; ++layerIndex)
+        for (t_ilm_uint layerIndex = 0; layerIndex < screenProperties.layerCount; ++layerIndex)
+        {
+            t_ilm_layer layerid = screenProperties.layerIds[layerIndex];
+            cout << layerid << "(0x" << hex << layerid << dec << "), ";
+        }
+        cout << "\n";
+    }
+    else
     {
-        t_ilm_layer layerid = screenProperties.layerIds[layerIndex];
-        cout << layerid << "(0x" << hex << layerid << dec << "), ";
+        cout << "No screen with ID :" << screenid;
+        cout << "\n";
     }
-    cout << "\n";
 }
 
 void printLayerProperties(unsigned int layerid, const char* prefix)