From 33d4ed1965a877fe86bee27ffcc62a51214243e1 Mon Sep 17 00:00:00 2001 From: idea4good Date: Wed, 9 Oct 2019 19:19:44 +0800 Subject: [PATCH] change init method for more robust --- widgets/slide_group.cpp | 5 +++-- widgets_include/slide_group.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/widgets/slide_group.cpp b/widgets/slide_group.cpp index f58cf06..d18e060 100644 --- a/widgets/slide_group.cpp +++ b/widgets/slide_group.cpp @@ -9,8 +9,9 @@ #include "../widgets_include/gesture.h" #include "../widgets_include/slide_group.h" -c_slide_group::c_slide_group() : m_gesture(this) +c_slide_group::c_slide_group() { + m_gesture = new c_gesture(this); for(int i = 0; i < MAX_PAGES; i++) { m_slides[i] = 0; @@ -159,7 +160,7 @@ bool c_slide_group::on_touch(int x, int y, TOUCH_ACTION action) x -= m_wnd_rect.m_left; y -= m_wnd_rect.m_top; - if (m_gesture.handle_swipe(x, y, action)) + if (m_gesture->handle_swipe(x, y, action)) { if (m_slides[m_active_slide_index]) { diff --git a/widgets_include/slide_group.h b/widgets_include/slide_group.h index 75eb271..95b5c1f 100644 --- a/widgets_include/slide_group.h +++ b/widgets_include/slide_group.h @@ -23,7 +23,7 @@ protected: virtual c_wnd* clone(){return new c_slide_group();} c_wnd* m_slides[MAX_PAGES]; int m_active_slide_index; - c_gesture m_gesture; + c_gesture* m_gesture; }; #endif