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

Widget Gallery exception on Win32 ( debug build ) #11

Open
RallyTronics opened this issue Jan 15, 2020 · 8 comments
Open

Widget Gallery exception on Win32 ( debug build ) #11

RallyTronics opened this issue Jan 15, 2020 · 8 comments

Comments

@RallyTronics
Copy link

I get a null pointer exception on line 161 "this->graphics_context._Mypair._Myval2 was nullptr."

auto canvas = graphics_context->create_canvas(size, canvas_flags);

in the window::draw() function

void window::draw()
  {
    graphics::canvas_flags canvas_flags;
    if(flags.test(window_flag::anti_alias))
      canvas_flags |= graphics::canvas_flag::anti_alias;

    auto canvas = graphics_context->create_canvas(size, canvas_flags);
    canvas->draw(canvas->background);

    element->draw(*canvas);
  }

@rubenvb
Copy link
Contributor

rubenvb commented Feb 18, 2020

If I had to guess, OpenGL initialization might have failed. I get something similar if I start it in my Windows VM without an OpenGL driver (or Mesa DLL) available. I do get a slightly different error though (in RelWithDebInfo configuration):

Exception thrown: write access violation.
std::_Atomic_address_as<long,std::_Atomic_padded<int> >(...) returned 0x8.

You can try using the CPU rendering path by removing the window_flag::opengl in gui/window_windows.c++. I plan to make this a runtime "choose the best thing possible" decision, but it hasn't been very high on my list as it's easily "fixable" and SkUI doesn't do much of anything yet anyway.

If switching to CPU rendering doesn't help, you'll need to give me a bit more information about your environment (OS version, compiler, etc.)

@lzy1g1225
Copy link

same issue on my computer, but I am not using VM.

@rubenvb
Copy link
Contributor

rubenvb commented Mar 17, 2020

I am still unable to reproduce but I have spotted a possible inconsistency in the window members intialization order. I have pushed a more robust version to master. Could you let me know the results? For the sake of reproducing this, could you also provide more details about your system/environment/configuration, e.g. OS, compiler, etc. Thanks!

@libaineu2004
Copy link

====Win7 x64/MSVC 2017 x64====
I change gui/window_windows.c++:L29 to this:
const window_flags window::default_flags = window_flag::exit_on_close | window_flag::anti_alias;

This example "examples / widget_gallery / Debug / widget_gallery.exe" can be run. But when I click the close button in the top right corner, the program does not exit.The dialog box is closed, but looking at the Windows Task Manager, I found that there is still this process. That is, the process has not been killed.
Why?

@rubenvb
Copy link
Contributor

rubenvb commented May 5, 2020

@libaineu2004 The logic around window closing was a bit backwards (or not backwards enough).
I pushed a fix which should ensure the window's render thread is properly stopped.

@libaineu2004
Copy link

@libaineu2004 The logic around window closing was a bit backwards (or not backwards enough).
I pushed a fix which should ensure the window's render thread is properly stopped.

I tested the new code "window.close ();" and still have problems.
An exception was thrown: Read access permission conflict.
_Parent_proxy is 0xDDDDDDDD.

The call stack is as follows:

widget_gallery.exe! std :: _ Iterator_base12 :: _ Adopt (const std :: _ Container_base12 * _Parent) line 164 C ++
widget_gallery.exe! std :: _ Vector_const_iterator <std :: _ Vector_val <std :: _ Simple_types <skui :: gui :: window *>>> :: _ Vector_const_iterator <std :: _ Vector_val <std :: _ Simple_types <skui :: gui: : window *>>> (skui :: gui :: window * * _Parg, const std :: _ Container_base12 * _Pvector) line 44 C ++
widget_gallery.exe! std :: _ Vector_iterator <std :: _ Vector_val <std :: _ Simple_types <skui :: gui :: window *>>> :: _ Vector_iterator <std :: _ Vector_val <std :: _ Simple_types <skui :: gui: : window *>>> (skui :: gui :: window * * _Parg, const std :: _ Container_base12 * _Pvector) line 254 C ++
widget_gallery.exe! std :: vector <skui :: gui :: window *, std :: allocator <skui :: gui :: window *>> :: end () line 1629 C ++
widget_gallery.exe! skui :: gui :: window :: close () line 131 C ++

void _Adopt(const _Container_base12 _Parent) noexcept
{ // adopt this iterator by parent
if (_Parent == nullptr)
{ // no future parent, just disown current parent
#if _ITERATOR_DEBUG_LEVEL == 2
_Lockit _Lock(_LOCK_DEBUG);
_Orphan_me();
#endif /
_ITERATOR_DEBUG_LEVEL == 2 */
}
else
{ // have a parent, do adoption
_Container_proxy *_Parent_proxy = _Parent->_Myproxy;

#if _ITERATOR_DEBUG_LEVEL == 2
if (_Myproxy != _Parent_proxy)
{ // change parentage
_Lockit _Lock(_LOCK_DEBUG);
_Orphan_me();
_Mynextiter = _Parent_proxy->_Myfirstiter;
_Parent_proxy->_Myfirstiter = this;
_Myproxy = _Parent_proxy;
}

#else /* _ITERATOR_DEBUG_LEVEL == 2 /
_Myproxy = _Parent_proxy;
#endif /
_ITERATOR_DEBUG_LEVEL == 2 */
}
}

@libaineu2004
Copy link

By the way, all of my cmake options use the default value of OFF.

//3rdparty dependencies
option (SKUI_USE_PREBUILT_3RDPARTY "Use a prebuilt 3rdparty package" OFF)
set (SKUI_PREBUILT_3RDPARTY_PATH CACHE STRING "NOTSET")
option (SKUI_USE_PREBUILT_ZLIB "Use a prebuilt zlib" $ {SKUI_USE_PREBUILT_3RDPARTY})
option (SKUI_USE_PREBUILT_LIBEXPAT "Use a prebuilt libexpat" $ {SKUI_USE_PREBUILT_3RDPARTY})
option (SKUI_USE_PREBUILT_LIBPNG "Use a prebuilt libpng" $ {SKUI_USE_PREBUILT_3RDPARTY})
option (SKUI_USE_PREBUILT_GIFLIB "Use a prebuilt giflib" $ {SKUI_USE_PREBUILT_3RDPARTY})
option (SKUI_USE_PREBUILT_LIBJPEG_TURBO "Use a prebuilt libjpeg-turbo" $ {SKUI_USE_PREBUILT_3RDPARTY})
option (SKUI_USE_PREBUILT_SKIA "Use a prebuilt Skia" $ {SKUI_USE_PREBUILT_3RDPARTY})
option (SKUI_USE_PREBUILT_BOOST "Use a prebuilt Boost" $ {SKUI_USE_PREBUILT_3RDPARTY})
option (SKUI_USE_SYSTEM_ZLIB "Use system zlib" OFF)
option (SKUI_USE_SYSTEM_LIBEXPAT "Use system libexpat" OFF)
option (SKUI_USE_SYSTEM_LIBPNG "Use system libpng" OFF)
option (SKUI_USE_SYSTEM_GIFLIB "Use system giflib" OFF)
option (SKUI_USE_SYSTEM_LIBJPEG_TURBO "Use system libjpeg-turbo" OFF)
option (SKUI_USE_SYSTEM_SKIA "Use system Skia library" OFF)
option (SKUI_USE_SYSTEM_BOOST "Use system Boost library" OFF)

@vanehu
Copy link

vanehu commented Nov 19, 2021

any idea about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants