Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operating the map before appending it to the widget tree leads to crash #40

Open
cpetrov opened this issue Nov 28, 2017 · 0 comments
Open

Comments

@cpetrov
Copy link
Member

cpetrov commented Nov 28, 2017

Problem description

The app crashes when calling map methods before the map has been added to the widget tree.

logcat output:

11-28 12:40:29.488  4951  4951 E FragmentManager: No view found for id 0x6 (unknown) for fragment SupportMapFragment{63c32c2 #0 id=0x6}
11-28 12:40:29.488  4951  4951 E FragmentManager: Activity state:
11-28 12:40:29.488  4951  4951 D FragmentManager:   Local FragmentActivity 553e549 State:
11-28 12:40:29.489  4951  4951 D FragmentManager:     mCreated=truemResumed=false mStopped=false mReallyStopped=false
11-28 12:40:29.489  4951  4951 D FragmentManager:     mLoadersStarted=false
11-28 12:40:29.489  4951  4951 D FragmentManager:   Active Fragments in 324e8d3:
11-28 12:40:29.489  4951  4951 D FragmentManager:     #0: SupportMapFragment{63c32c2 #0 id=0x6}
11-28 12:40:29.489  4951  4951 D FragmentManager:       mFragmentId=#6 mContainerId=#6 mTag=null
11-28 12:40:29.490  4951  4951 D FragmentManager:       mState=1 mIndex=0 mWho=android:fragment:0 mBackStackNesting=0
11-28 12:40:29.490  4951  4951 D FragmentManager:       mAdded=true mRemoving=false mFromLayout=false mInLayout=false
11-28 12:40:29.491  4951  4951 D FragmentManager:       mHidden=false mDetached=false mMenuVisible=true mHasMenu=false
11-28 12:40:29.491  4951  4951 D FragmentManager:       mRetainInstance=false mRetaining=false mUserVisibleHint=true
11-28 12:40:29.491  4951  4951 D FragmentManager:       mFragmentManager=FragmentManager{324e8d3 in HostCallbacks{bd99c10}}
11-28 12:40:29.491  4951  4951 D FragmentManager:       mHost=android.support.v4.app.FragmentActivity$HostCallbacks@bd99c10
11-28 12:40:29.491  4951  4951 D FragmentManager:   Added Fragments:
11-28 12:40:29.491  4951  4951 D FragmentManager:     #0: SupportMapFragment{63c32c2 #0 id=0x6}
11-28 12:40:29.491  4951  4951 D FragmentManager:   FragmentManager misc state:
11-28 12:40:29.491  4951  4951 D FragmentManager:     mHost=android.support.v4.app.FragmentActivity$HostCallbacks@bd99c10
11-28 12:40:29.492  4951  4951 D FragmentManager:     mContainer=android.support.v4.app.FragmentActivity$HostCallbacks@bd99c10
11-28 12:40:29.492  4951  4951 D FragmentManager:     mCurState=2 mStateSaved=false mDestroyed=false
11-28 12:40:29.492  4951  4951 D FragmentManager:   View Hierarchy:
11-28 12:40:29.492  4951  4951 D FragmentManager:     com.android.internal.policy.DecorView{d948309 V.E..... ... 0,0-0,0}
11-28 12:40:29.492  4951  4951 D FragmentManager:       android.widget.LinearLayout{a1eb90e V.E..... ... 0,0-0,0}
11-28 12:40:29.493  4951  4951 D FragmentManager:         android.view.ViewStub{a4b3f2f G.E..... ... 0,0-0,0 #1020186 android:id/action_mode_bar_stub}
11-28 12:40:29.493  4951  4951 D FragmentManager:         android.widget.FrameLayout{ca4693c V.E..... ... 0,0-0,0}
11-28 12:40:29.493  4951  4951 D FragmentManager:           android.support.v7.widget.FitWindowsFrameLayout{a7946c5 V.E..... ... 0,0-0,0 #7f0e0078 app:id/action_bar_root}
11-28 12:40:29.494  4951  4951 D FragmentManager:             android.support.v7.widget.ContentFrameLayout{a91581a V.E..... ... 0,0-0,0 #1020002 android:id/content}
11-28 12:40:29.495  4951  4951 D FragmentManager:               com.eclipsesource.tabris.android.internal.toolkit.view.TabrisDrawerLayout{f933747 VFE..... ... 0,0-0,0 #7f0e00c6 app:id/tabris_drawer_layout}
11-28 12:40:29.495  4951  4951 D FragmentManager:                 com.eclipsesource.tabris.android.internal.toolkit.view.Composite{f6c789d VFE..... ... 0,0-0,0}
11-28 12:40:29.495  4951  4951 D FragmentManager:                 org.apache.cordova.engine.SystemWebView{6d69f4b GFEDH.C. ... 0,0-0,0}
11-28 12:40:29.496  4951  4951 D FragmentManager:                 com.eclipsesource.tabris.android.internal.toolkit.view.Composite{61d0199 VFE...C. ... 0,0-0,0 #7f0e00c7 app:id/tabris_app_drawer}
11-28 12:40:29.496  4951  4951 D FragmentManager:                 com.eclipsesource.tabris.android.internal.toolkit.DeveloperConsoleView{cecdd28 V.E..... ... 0,0-0,0 #7f0e00c8 app:id/tabris_developer_console}
11-28 12:40:29.496  4951  4951 D FragmentManager:                   android.support.v7.widget.Toolbar{12c8a41 V.E..... ... 0,0-0,0 #7f0e009f app:id/developer_console_toolbar}
11-28 12:40:29.497  4951  4951 D FragmentManager:                     com.eclipsesource.tabris.android.internal.toolkit.DeveloperConsoleUrlEditText{15cdbe6 VFED..CL ... 0,0-0,0 #7f0e00a0 app:id/developer_console_url_edit_text}
11-28 12:40:29.497  4951  4951 D FragmentManager:                     android.support.v7.widget.ActionMenuView{96de527 V.E..... ... 0,0-0,0}
11-28 12:40:29.497  4951  4951 D FragmentManager:                       android.support.v7.view.menu.ActionMenuItemView{2c6a3d4 VFED..CL ... 0,0-0,0 #7f0e00cc app:id/developer_console_action_restart}
11-28 12:40:29.497  4951  4951 D FragmentManager:                       android.support.v7.widget.ActionMenuPresenter$OverflowMenuButton{e76897d VFED..CL ... 0,0-0,0}
11-28 12:40:29.497  4951  4951 D FragmentManager:                   android.support.v7.widget.AppCompatEditText{a0ad072 VFED..CL ... 0,0-0,0 #7f0e00a1 app:id/developer_console_command_edit_text}
11-28 12:40:29.497  4951  4951 D FragmentManager:                   android.view.View{c49acc3 V.ED.... ... 0,0-0,0 #7f0e00a2 app:id/developer_console_input_separator}
11-28 12:40:29.498  4951  4951 D FragmentManager:                   android.support.v7.widget.RecyclerView{fd42940 VFED.V.. ... 0,0-0,0 #7f0e00a3 app:id/developer_console_log}
11-28 12:40:29.498  4951  4951 D FragmentManager:             android.support.v7.widget.ViewStubCompat{9674079 G.E..... ... 0,0-0,0 #7f0e0079 app:id/action_mode_bar_stub}
11-28 12:40:29.498  4951  4951 D AndroidRuntime: Shutting down VM
11-28 12:40:29.500  4951  4951 E AndroidRuntime: FATAL EXCEPTION: main

Expected behavior

Calling map methods before adding it to the widget tree should not lead to an app crash.

Environment

  • Tabris.js version: 2.x-nightly
  • Device: emulator
  • OS: Android 8

Code snippet

new esmaps.Map({
  left: 0, right: 0, top: 0, bottom: 0
}).on('ready', ({target: map}) => {
  console.log('ready')
  map.camera = {position: [48.8644458, 2.3589976]};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant