libaurum: make an uiobject not to use an invalid inner handler.
authorWonki Kim <wonki_.kim@samsung.com>
Tue, 22 Dec 2020 12:55:56 +0000 (21:55 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Wed, 23 Dec 2020 01:54:24 +0000 (10:54 +0900)
An atspi object can be removed even if ref count isn't zero, when a parent window is destroyed.
on object destroyed callback, uiobject set invalid flag by itself
to prevent crahsing by calling atspi api with invalid handler.

Change-Id: Ifb8efee7b97d46e418404aea30198a72ebe90fcd

14 files changed:
libaurum/inc/Accessibility/AccessibleNode.h
libaurum/inc/Accessibility/AccessibleWatcher.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleNode.h
libaurum/inc/Impl/Accessibility/AtspiAccessibleWatcher.h
libaurum/inc/Impl/Accessibility/MockAccessibleNode.h
libaurum/inc/Impl/Accessibility/MockAccessibleWatcher.h
libaurum/inc/UiObject.h
libaurum/src/Accessibility/AccessibleNode.cc
libaurum/src/Accessibility/AccessibleWatcher.cc
libaurum/src/Impl/Accessibility/AtspiAccessibleNode.cc
libaurum/src/Impl/Accessibility/AtspiAccessibleWatcher.cc
libaurum/src/Impl/Accessibility/MockAccessibleNode.cc
libaurum/src/Impl/TizenDeviceImpl.cc
libaurum/src/UiObject.cc

index 65a6d831471a408f08887687d75a9b86e782c182..78814fe045725a0d728d1fde660b6577e714b98f 100644 (file)
@@ -4,8 +4,11 @@
 #include <memory>
 #include <string>
 #include <vector>
+#include <mutex>
 
 #include "AccessibleUtils.h"
+#include "IEventConsumer.h"
+
 #include "Rect.h"
 #include "config.h"
 
@@ -59,7 +62,7 @@ enum class NodeFeatureProperties {
  * @brief AccessibleNode Class
  * @since_tizen 5.5
  */
-class AccessibleNode {
+class AccessibleNode : public std::enable_shared_from_this<AccessibleNode>, public IEventConsumer  {
 public:  // Constructor & Destructor
     /**
      * @brief TBD
@@ -104,6 +107,18 @@ public:
      */
     virtual std::shared_ptr<AccessibleNode> getParent() const = 0;
 
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    void notify(int type, int type2, void *src) override;
+
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    void invalidate();
+
 public:
     /**
      * @brief TBD
@@ -274,6 +289,12 @@ public:
      */
     virtual void setValue(std::string text) = 0;
 
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    virtual bool isValid() const;
+
 public:
     /**
      * @brief TBD
@@ -343,4 +364,15 @@ protected:
      * @brief TBD
      */
     int mFeatureProperty;
+
+private:
+    /**
+     * @brief TBD
+     */
+    bool mValid;
+
+    /**
+     * @brief TBD
+     */
+    mutable std::mutex mLock;
 };
\ No newline at end of file
index 6d06ad210bcbbe54769dab1f4f3e130b04c40dd6..d767742d2b35a4fff6b382a01cf3696dce132f8d 100644 (file)
@@ -4,22 +4,28 @@
 #include "AccessibleApplication.h"
 #include "AccessibleWindow.h"
 #include "AccessibleNode.h"
-
 #include "AccessibleUtils.h"
+#include "IEventSource.h"
 
 #include <memory>
 #include <vector>
-
+#include <set>
+#include <mutex>
 
 #include "config.h"
 
-
 /**
  * @brief AccessibleWatcher class
  * @since_tizen 5.5
  */
-class AccessibleWatcher {
+class AccessibleWatcher : public IEventSource {
 public:
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    AccessibleWatcher();
+
     /**
      * @brief TBD
      * @since_tizen 5.5
@@ -30,7 +36,7 @@ public:
      * @brief TBD
      * @since_tizen 5.5
      */
-    static const AccessibleWatcher *getInstance(AccessibleWatcher *watcherImpl = nullptr);
+    static AccessibleWatcher *getInstance(AccessibleWatcher *watcherImpl = nullptr);
 
 public:
     /**
@@ -57,4 +63,33 @@ public:
      * @since_tizen 5.5
      */
     virtual std::vector<std::shared_ptr<AccessibleApplication>> getActiveApplications(void) const;
+public:
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    void attach(std::shared_ptr<IEventConsumer> source) override;
+
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    void detach(std::shared_ptr<IEventConsumer> source) override;
+
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    void notifyAll(int type, int type2, void *src) override;
+
+private:
+    /**
+     * @brief TBD
+     */
+    std::set<std::shared_ptr<IEventConsumer>> mSources;
+
+    /**
+     * @brief TBD
+     */
+    std::mutex mLock;
 };
\ No newline at end of file
index eec9007c05e64fab2d13cbef79fd453b9a186a9d..2554ab4baee34e7ce358daf29889d4850cd475cf 100644 (file)
@@ -45,7 +45,7 @@ public:
      * @brief TBD
      * @since_tizen 5.5
      */
-    bool isValid() const;
+    bool isValid() const override;
 
 public:
     /**
index 79bdc651c51a8eb1b7168d9f6e460a25d223c694..3eb3566d436b0a6855e122631df1ba1a427efad6 100644 (file)
@@ -5,7 +5,6 @@
 #include <atspi/atspi.h>
 #include <gio/gio.h>
 
-#include <mutex>
 #include <shared_mutex>
 #include <memory>
 #include <list>
@@ -103,7 +102,7 @@ public:
      * @brief TBD
      * @since_tizen 5.5
      */
-    static void onAtspiWindowEvent(AtspiEvent *event, void *user_data);
+    static void onAtspiEvents(AtspiEvent *event, void *user_data);
 
     /**
      * @brief TBD
@@ -179,11 +178,6 @@ private:
      */
     GDBusProxy *                                  mDbusProxy;
 
-    /**
-     * @brief TBD
-     */
-    std::mutex                            mLock;
-
     /**
      * @brief TBD
      */
index 80e8ad3b7364f63f5adccdfcbdf426ba4ad4ea97..1f7b8fe9ce179811f3fdb89f4acb2d6746eb69d6 100644 (file)
@@ -4,13 +4,13 @@
 #include <mutex>
 #include <set>
 
-class MockAccessibleNode : public AccessibleNode, public std::enable_shared_from_this<MockAccessibleNode> {
+class MockAccessibleNode : public AccessibleNode {
 public:
     /**
      * @brief TBD
      * @since_tizen 5.5
      */
-    MockAccessibleNode(std::shared_ptr<MockAccessibleNode> parent, std::string text,std::string pkg,std::string role, std::string id, std::string type,std::string style, std::string automationId, Rect<int> boundingBox,int supportingIfaces,int featureProperty);
+    MockAccessibleNode(std::shared_ptr<AccessibleNode> parent, std::string text,std::string pkg,std::string role, std::string id, std::string type,std::string style, std::string automationId, Rect<int> boundingBox,int supportingIfaces,int featureProperty);
 
     /**
      * @brief TBD
index 2d523d39cea008424556168bde77e6700d517163..5262cf215f33b0d827f8485b0fc5acb8c563d61b 100644 (file)
@@ -60,9 +60,4 @@ private:
      * @brief TBD
      */
     std::vector<std::shared_ptr<AccessibleApplication>> mApplicationList;
-
-    /**
-     * @brief TBD
-     */
-    std::mutex                            mLock;
 };
\ No newline at end of file
index 8fc4060454b32eea0cb0cdba34f451e873514a68..b670dd73116bbd478f0a6f7f793320852bc25472 100644 (file)
@@ -293,6 +293,12 @@ public:
      */
     void refresh() const;
 
+    /**
+     * @brief TBD
+     * @since_tizen 5.5
+     */
+    bool isValid() const;
+
     /**
      * @brief TBD
      * @since_tizen 5.5
index b2670b6357ceb11df26ed3aea9a34eea52092e4b..6e86d513e52eb868161b4c5ae04f556a7a448eab 100644 (file)
@@ -13,8 +13,8 @@ AccessibleNode::~AccessibleNode()
 }
 
 AccessibleNode::AccessibleNode()
-    : mText{""}, mPkg{""}, mRole{""}, mId{""}, mAutomationId{""}, mType{""}, mStyle{""},
-      mBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0)
+: mText{""}, mPkg{""}, mRole{""}, mId{""}, mType{""}, mStyle{""},
+  mBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0), mValid{true}, mLock{}
 {
 }
 
@@ -64,6 +64,30 @@ std::string AccessibleNode::description() {
     return ss.str();
 }
 
+void AccessibleNode::notify(int type, int type2, void *src)
+{
+    LOG_SCOPE_F(INFO, "notified for obj(%p) t1:%d t2:%d src:%p",this, type, type2, src);
+    void *handler = getRawHandler();
+
+    if ((EventType)type == EventType::Object && (ObjectEventType)type2 == ObjectEventType::ObjectStateDefunct) {
+        if (handler == src) invalidate();
+    }
+}
+
+void AccessibleNode::invalidate()
+{
+    std::unique_lock<std::mutex> lock(mLock);
+    LOG_F(INFO, "object %p is now invalid", this);
+    mValid = false;
+}
+
+bool AccessibleNode::isValid() const
+{
+    std::unique_lock<std::mutex> lock(mLock);
+    if (!getRawHandler() || !mValid) return false;
+    return true;
+}
+
 void AccessibleNode::print(int depth, int maxDepth)
 {
     if (maxDepth <= 0 || depth > maxDepth) return;
index 647d7e4cde429b8ec9f219cb7c020beb47158a77..3073482a25fa38e41728a9b65f987d4128396ca3 100644 (file)
 #include <algorithm>
 #include <loguru.hpp>
 
-
+AccessibleWatcher::AccessibleWatcher()
+:mSources{}, mLock{}
+{
+}
 
 AccessibleWatcher::~AccessibleWatcher()
 {
@@ -34,7 +37,7 @@ void AccessibleWatcher::printDbgInformation() const
 }
 */
 
-const AccessibleWatcher *AccessibleWatcher::getInstance(AccessibleWatcher *watcherImpl)
+AccessibleWatcher *AccessibleWatcher::getInstance(AccessibleWatcher *watcherImpl)
 {
     static AccessibleWatcher *mInstance = nullptr;
     if (watcherImpl) {
@@ -69,4 +72,31 @@ std::vector<std::shared_ptr<AccessibleApplication>> AccessibleWatcher::getActive
     LOG_F(INFO, "active apps size %d", apps.size());
 
     return apps;
-}
\ No newline at end of file
+}
+
+void AccessibleWatcher::attach(std::shared_ptr<IEventConsumer> source)
+{
+    std::unique_lock<std::mutex> lock(mLock);
+    LOG_F(INFO, "source attached %p", source.get());
+    if (source) {
+        mSources.insert(source);
+    }
+}
+
+void AccessibleWatcher::detach(std::shared_ptr<IEventConsumer> source)
+{
+    std::unique_lock<std::mutex> lock(mLock);
+    LOG_F(INFO, "source detached %p", source.get());
+    if (source) {
+        auto iter = mSources.find(source);
+        if (iter != mSources.end()) mSources.erase(iter);
+    }
+}
+
+void AccessibleWatcher::notifyAll(int type, int type2, void *src)
+{
+    std::unique_lock<std::mutex> lock(mLock);
+    std::for_each(mSources.begin(), mSources.end(), [&](auto source){
+        source->notify(type, type2, src);
+    });
+}
index 2e5e5436c809cb9f6f572716cfad59651d34778c..ab5c8237bcae454694245c931fa828c105204ffd 100644 (file)
@@ -1,4 +1,5 @@
 #include "AtspiAccessibleNode.h"
+#include "AccessibleWatcher.h"
 
 #include <gio/gio.h>
 
@@ -9,8 +10,12 @@
 AtspiAccessibleNode::AtspiAccessibleNode(AtspiAccessible *node)
 : mNode{node}
 {
-  if (mNode) {
-    GArray *ifaces = atspi_accessible_get_interfaces(mNode);
+    const auto trickDontRemove = std::shared_ptr<AtspiAccessibleNode>( this, [](AtspiAccessibleNode*){} );
+    auto watcher = AccessibleWatcher::getInstance();
+    watcher->attach(shared_from_this());
+
+    if (mNode) {
+        GArray *ifaces = atspi_accessible_get_interfaces(mNode);
         if (ifaces) {
             for (unsigned int i = 0; i < ifaces->len; i++) {
                 char *iface = g_array_index(ifaces, char *, i);
@@ -68,6 +73,8 @@ AtspiAccessibleNode::AtspiAccessibleNode(AtspiAccessible *node)
 
 AtspiAccessibleNode::~AtspiAccessibleNode()
 {
+    auto watcher = AccessibleWatcher::getInstance();
+    watcher->detach(shared_from_this());
     if(mNode) g_object_unref(mNode);
 }
 
@@ -81,7 +88,7 @@ int AtspiAccessibleNode::getChildCount() const
 
 std::shared_ptr<AccessibleNode> AtspiAccessibleNode::getChildAt(int index) const
 {
-    if (!isValid()) std::make_shared<AtspiAccessibleNode>(nullptr);
+    if (!isValid()) return std::make_shared<AtspiAccessibleNode>(nullptr);
     LOG_SCOPE_F(INFO, "getChild @ %d from node(%p)", index, mNode);
     AtspiAccessible *rawChild = atspi_accessible_get_child_at_index(mNode, index, NULL);
     return std::make_shared<AtspiAccessibleNode>(rawChild);
@@ -109,7 +116,7 @@ std::shared_ptr<AccessibleNode> AtspiAccessibleNode::getParent() const
 }
 bool AtspiAccessibleNode::isValid() const
 {
-    if (!mNode) return false;
+    if(!AccessibleNode::isValid())  return false;
 
     AtspiStateSet *st = atspi_accessible_get_state_set(mNode);
     if (!st) return false;
index 815ea2068901ba90693c29f870f3276cc46d3761..f3cdfaa54169a28cd386aaa6ca165776baa856a0 100644 (file)
@@ -68,7 +68,7 @@ findActiveNode(AtspiAccessible *node, int depth,
 }
 
 AtspiAccessibleWatcher::AtspiAccessibleWatcher()
-: mDbusProxy{nullptr}, mLock{}
+: mDbusProxy{nullptr}
 {
     GVariant *enabled_variant = nullptr, *result = nullptr;
     GError *  error = nullptr;
@@ -76,12 +76,9 @@ AtspiAccessibleWatcher::AtspiAccessibleWatcher()
     atspi_init();
 
     listener =
-        atspi_event_listener_new(AtspiAccessibleWatcher::onAtspiWindowEvent, this, NULL);
+        atspi_event_listener_new(AtspiAccessibleWatcher::onAtspiEvents, this, NULL);
 
-    atspi_event_listener_register(listener, "window:create", NULL);
-    atspi_event_listener_register(listener, "window:destroy", NULL);
-    atspi_event_listener_register(listener, "window:activate", NULL);
-    atspi_event_listener_register(listener, "window:deactivate", NULL);
+    atspi_event_listener_register(listener, "window:", NULL);
     atspi_event_listener_register(listener, "object:", NULL);
 
     mDbusProxy = g_dbus_proxy_new_for_bus_sync(
@@ -124,7 +121,7 @@ AtspiAccessibleWatcher::~AtspiAccessibleWatcher()
 }
 
 
-void AtspiAccessibleWatcher::onAtspiWindowEvent(AtspiEvent *event, void *user_data)
+void AtspiAccessibleWatcher::onAtspiEvents(AtspiEvent *event, void *user_data)
 {
     char *name = NULL, *pname = NULL;
     AtspiAccessibleWatcher *instance = (AtspiAccessibleWatcher *)user_data;
@@ -135,19 +132,13 @@ void AtspiAccessibleWatcher::onAtspiWindowEvent(AtspiEvent *event, void *user_da
         return;
     }
 
-
-    AtspiAccessible *parent = atspi_accessible_get_parent(event->source, NULL);
-
     name = atspi_accessible_get_name(event->source, NULL);
+    AtspiAccessible *parent = atspi_accessible_get_parent(event->source, NULL);
     if (parent) {
         pname = atspi_accessible_get_name(parent, NULL);
         g_object_unref(parent);
     }
 
-     LOG_SCOPE_F(INFO, "event:%s, src:%p(%s), p:%p(%s), d1:%p d2:%p instance:%p",
-                 event->type, event->source, name, parent, pname, event->detail1,
-                 event->detail2, instance);
-
     if (!strcmp(event->type, "window:activate")) {
         instance->onWindowActivated(
             static_cast<AtspiAccessible *>(event->source),
@@ -194,43 +185,38 @@ void AtspiAccessibleWatcher::print_debug()
 void AtspiAccessibleWatcher::onWindowActivated(AtspiAccessible *node,
                             WindowActivateInfoType type)
 {
-    //std::unique_lock<std::mutex> lock(mLock);
     LOG_SCOPE_F(INFO, "onWindowActivated obj:%p", node);
-    //addToActivatedList((node));
-    return;
+    notifyAll((int)EventType::Window, (int)WindowEventType::WindowActivated, node);
 }
 
 void AtspiAccessibleWatcher::onWindowDeactivated(AtspiAccessible *node)
 {
-    std::unique_lock<std::mutex> lock(mLock);
     LOG_SCOPE_F(INFO, "onWindowDeactivated obj:%p", node);
-    //removeFromActivatedList(node);
+    notifyAll((int)EventType::Window, (int)WindowEventType::WindowDeactivated, node);
 }
 
 void AtspiAccessibleWatcher::onWindowCreated(AtspiAccessible *node)
 {
-    std::unique_lock<std::mutex> lock(mLock);
     LOG_SCOPE_F(INFO, "onWindowCreated obj:%p", node);
-    //addToWindowSet(node);
+    notifyAll((int)EventType::Window, (int)WindowEventType::WindowCreated, node);
 }
 
 void AtspiAccessibleWatcher::onWindowDestroyed(AtspiAccessible *node)
 {
-    std::unique_lock<std::mutex> lock(mLock);
     LOG_SCOPE_F(INFO, "onWindowDestroyed obj:%p vis:%d", node);
-    //removeFromWindowSet(node);
+    notifyAll((int)EventType::Window, (int)WindowEventType::WindowDestroyed, node);
 }
 
 void AtspiAccessibleWatcher::onVisibilityChanged(AtspiAccessible *node, bool visible)
 {
-    std::unique_lock<std::mutex> lock(mLock);
-    LOG_SCOPE_F(INFO, "onVisibilityChanged obj:%p vis:%d", node, visible);
+    LOG_SCOPE_F(INFO, "onVisibilityChanged obj:%p", node);
+    notifyAll((int)EventType::Object, (int)ObjectEventType::ObjectStateVisible, node);
 }
 
 void AtspiAccessibleWatcher::onObjectDefunct(AtspiAccessible *node)
 {
-    std::unique_lock<std::mutex> lock(mLock);
     LOG_SCOPE_F(INFO, "onObjectDefunct obj:%p", node);
+    notifyAll((int)EventType::Object, (int)ObjectEventType::ObjectStateDefunct, node);
 }
 
 
@@ -325,79 +311,3 @@ bool AtspiAccessibleWatcher::addToWindowSet(AtspiAccessible *node)
     }
     return false;
 }
-
-/*
-std::shared_ptr<AccessibleNode> AtspiAccessibleWatcher::getRootNode() const
-{
-    auto node = atspi_get_desktop(0);
-    auto aNode = std::make_shared<AccessibleNode>(node);
-    return accNode;
-}
-
-std::vector<std::shared_ptr<AccessibleNode>> AtspiAccessibleWatcher::getTopNode() const
-{
-    AtspiAccessible *topNode = nullptr, *activeNode = nullptr;
-    std::vector<std::shared_ptr<AccessibleNode>> ret;
-
-    {
-        std::unique_lock<std::mutex> lock(mLock);
-        if (!mActivatedWindowList.empty()) {
-            topNode = mActivatedWindowList.front();
-            std::list<AtspiAccessible *>::const_iterator iterator;
-            for (iterator = mActivatedWindowList.begin(); iterator != mActivatedWindowList.end(); ++iterator){
-                if (*iterator && iShowingNode(*iterator)) {
-                    AtspiAccessible *child = atspi_accessible_get_application(*iterator, NULL);
-                    if (child) {
-                        auto tmpNode = make_gobj_unique(child);
-                        auto node =  AccessibleNode::get(tmpNode.get());
-                        if (tmpNode.get()) g_object_unref(tmpNode.get());
-                        ret.push_back((node));
-                    }
-                }
-            }
-            return ret;
-        }
-    }
-
-    LOG_F(INFO, "Mo activated window node or Invisible acticated window / topNdoe(%p)", topNode);
-    LOG_F(INFO, "Trying fallback logic");
-
-    auto rootNode = make_gobj_unique(atspi_get_desktop(0));
-
-    if (rootNode) {
-        std::vector<AtspiAccessible*> activeNodes = findActiveNode(rootNode.get(), 0, 2);
-        if (!activeNodes.empty()) {
-            std::set<AtspiAccessible*> appset{};
-            for (auto iterator = activeNodes.begin(); iterator != activeNodes.end(); ++iterator){
-                //auto tmpNode = make_gobj_unique(atspi_accessible_get_application(*iterator, NULL));
-                auto app = atspi_accessible_get_application(*iterator, NULL);
-                appset.insert(app);
-            }
-            for (auto iterator = appset.begin(); iterator != appset.end(); ++iterator){
-                auto node = AccessibleNode::get(*iterator);
-                g_object_unref(*iterator);
-                LOG_F(INFO, "app has showing window found %p %s %s", node.get(), node->getText().c_str(), node->getPkg().c_str());
-                ret.push_back((node));
-            }
-        } else {
-            auto node = AccessibleNode::get(rootNode.get());
-            if (rootNode.get()) g_object_unref(rootNode.get());
-            ret.push_back((node));
-        }
-    }
-    return ret;
-}
-*/
-/*
-void AtspiAccessibleWatcher::clearWindowList()
-{
-    std::unique_lock<std::mutex> lock(mLock);
-
-    std::for_each(mActivatedWindowSet.begin(), mActivatedWindowSet.end(), [](auto window){
-        g_object_unref(window);
-    });
-    mActivatedWindowSet.clear();
-
-    mWindowSet.clear();
-}
-*/
\ No newline at end of file
index 4bf3980901fa96fe7a1e877abc08f0d54b690207..121c31d8ce0f68ac8e344457d859babda5b7d289 100644 (file)
@@ -1,16 +1,25 @@
 #include "MockAccessibleNode.h"
+#include "AccessibleWatcher.h"
 
 #include <algorithm>
 #include <iostream>
 
-MockAccessibleNode::MockAccessibleNode(std::shared_ptr<MockAccessibleNode> parent, std::string text, std::string pkg, std::string role, std::string res, std::string type, std::string style,std::string automationId,  Rect<int> boundingBox, int supportingIfaces,int featureProperty)
-: mParentNode(parent), mChildrenList{}, mActionSet{}, mLock{}
+MockAccessibleNode::MockAccessibleNode(std::shared_ptr<AccessibleNode> parent, std::string text, std::string pkg, std::string role, std::string res, std::string type, std::string style,std::string automationId,  Rect<int> boundingBox, int supportingIfaces,int featureProperty)
+: mParentNode(parent), mChildrenList{}, mActionSet{}
 {
+    printf("%s:%d / %s\n",__FILE__, __LINE__, __PRETTY_FUNCTION__);
+    const auto trickDontRemove = std::shared_ptr<MockAccessibleNode>( this, [](MockAccessibleNode*){} );
+
     setProperties(text,pkg,role,res,type,style,automationId, boundingBox, supportingIfaces, featureProperty);
+    auto watcher = AccessibleWatcher::getInstance();
+    watcher->attach(shared_from_this());
 }
 
 MockAccessibleNode::~MockAccessibleNode()
 {
+    printf("%s:%d / %s\n",__FILE__, __LINE__, __PRETTY_FUNCTION__);
+    auto watcher = AccessibleWatcher::getInstance();
+    watcher->detach(shared_from_this());
 }
 
 int MockAccessibleNode::getChildCount() const
@@ -34,7 +43,8 @@ std::shared_ptr<AccessibleNode> MockAccessibleNode::getParent() const
 
 void* MockAccessibleNode::getRawHandler(void) const
 {
-    return (void*)0;
+    printf("%s:%d / %s\n",__FILE__, __LINE__, __PRETTY_FUNCTION__);
+    return (void*)1;
 }
 
 void MockAccessibleNode::setProperties(std::string text,std::string pkg,std::string role,std::string id,std::string type,std::string style,std::string automationId, Rect<int> boundingBox,int supportingIfaces,int featureProperty)
@@ -125,8 +135,6 @@ void MockAccessibleNode::addChild(std::shared_ptr<AccessibleNode> child)
 
 std::shared_ptr<MockAccessibleNode> MockAccessibleNode::addChild(std::string text, std::string pkg, std::string role, std::string res, std::string type, std::string style, std::string automationId, Rect<int> geometry, int ifaces, int properties)
 {
-    std::unique_lock<std::mutex> lock(mLock);
-
     auto node = std::make_shared<MockAccessibleNode>(shared_from_this(), text, pkg, role, res, type, style, automationId, geometry, ifaces, properties);
     this->addChild(node);
     return node;
index 6ee1446bb462f702764f99e2db181bf75971ba38..d496e4e6ad6a9b393c3b54192d31f3c0d69ff1b3 100644 (file)
@@ -46,6 +46,8 @@ bool TizenDeviceImpl::click(const int x, const int y)
 
 bool TizenDeviceImpl::click(const int x, const int y, const unsigned int intv)
 {
+    LOG_SCOPE_F(INFO, "click %d %d , intv:%d", x, y, intv);
+
     int seq = touchDown(x, y);
     if (seq < 0) return false;
     usleep(intv * MSEC_PER_SEC);
@@ -58,7 +60,7 @@ bool TizenDeviceImpl::click(const int x, const int y, const unsigned int intv)
 int TizenDeviceImpl::touchDown(const int x, const int y)
 {
     int seq = grabTouchSeqNumber();
-    LOG_F(INFO, "touch down %d %d , seq:%d", x, y, seq);
+    LOG_SCOPE_F(INFO, "touch down %d %d , seq:%d", x, y, seq);
     if (seq >= 0) {
         auto args = std::make_tuple(this, x, y, seq);
         long result = (long)ecore_main_loop_thread_safe_call_sync([](void *data)->void*{
@@ -80,7 +82,7 @@ int TizenDeviceImpl::touchDown(const int x, const int y)
 
 bool TizenDeviceImpl::touchMove(const int x, const int y, const int seq)
 {
-    LOG_F(INFO, "touch move %d %d, seq:%d", x, y, seq);
+    LOG_SCOPE_F(INFO, "touch move %d %d, seq:%d", x, y, seq);
     if (seq >= 0) {
         auto args = std::make_tuple(this, x, y, seq);
         long result = (long)ecore_main_loop_thread_safe_call_sync([](void *data)->void*{
@@ -99,7 +101,7 @@ bool TizenDeviceImpl::touchMove(const int x, const int y, const int seq)
 
 bool TizenDeviceImpl::touchUp(const int x, const int y, const int seq)
 {
-    LOG_F(INFO, "touch up %d %d, seq:%d", x, y, seq);
+    LOG_SCOPE_F(INFO, "touch up %d %d, seq:%d", x, y, seq);
     if (seq >= 0) {
         auto args = std::make_tuple(this, x, y, seq);
         long result = (long)ecore_main_loop_thread_safe_call_sync([](void *data)->void*{
@@ -116,7 +118,7 @@ bool TizenDeviceImpl::touchUp(const int x, const int y, const int seq)
 
 bool TizenDeviceImpl::wheelUp(int amount, const int durationMs)
 {
-    LOG_F(INFO, "wheel up %d for %d", amount, durationMs);
+    LOG_SCOPE_F(INFO, "wheel up %d for %d", amount, durationMs);
     auto args = std::make_tuple(this);
     long result = -1;
     for (int i = 0; i < amount; i++){
@@ -133,7 +135,7 @@ bool TizenDeviceImpl::wheelUp(int amount, const int durationMs)
 
 bool TizenDeviceImpl::wheelDown(int amount, const int durationMs)
 {
-    LOG_F(INFO, "wheel down %d for %d", amount, durationMs);
+    LOG_SCOPE_F(INFO, "wheel down %d for %d", amount, durationMs);
     auto args = std::make_tuple(this);
     long result = -1;
     for (int i = 0; i < amount; i++){
index 03f07e1d86dc03572ea4d56d75eff47d0ce9bf2f..e363c7e1c25e57c30f7a5b46fcaebbee6959bb6e 100644 (file)
@@ -263,6 +263,11 @@ void UiObject::refresh() const
     mNode->refresh();
 }
 
+bool UiObject::isValid() const
+{
+    return mNode->isValid();
+}
+
 const Rect<int> UiObject::getBoundingBox() const
 {
     mNode->refresh();