Strange issues with wxpython, wx-3.0-gtk2. C++ assertion "IsOk()" failed

1.1k Views Asked by At

I use TaskCoach-1.4.3, which is written in Python2.7 and wxpython-3.0-gtk2. No code changes was made to original, and I used it more than 2 years, but one day it stopped working with strange error.

Gtk-Message: (for origin information, set GTK_DEBUG): failed to retrieve property `gtk-primary-button-warps-slider' of type `gboolean' from rc file value "((GString*) 0x5d546b17a0)" of type `gboolean'
Traceback (most recent call last):
  File "/home/user/bin/taskcoach/taskcoachlib/gui/artprovider.py", line 62, in CreateBitmap
    return self._CreateBitmap(artId, artClient, size)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/artprovider.py", line 69, in _CreateBitmap
    bitmap = icons.catalog[catalogKey].getBitmap()
  File "/usr/lib64/python2.7/site-packages/wx-3.0-gtk2/wx/lib/embeddedimage.py", line 48, in GetBitmap
    return wx.BitmapFromImage(self.GetImage())
  File "/usr/lib64/python2.7/site-packages/wx-3.0-gtk2/wx/_gdi.py", line 884, in BitmapFromImage
    val = _gdi_.new_BitmapFromImage(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "image.IsOk()" failed at /var/tmp/portage/x11-libs/wxGTK-3.0.2.0-r2/work/wxPython-src-3.0.2.0/src/gtk/bitmap.cpp(626) in wxBitmap(): invalid image
persons_icon
Traceback (most recent call last):
  File "/home/user/bin/tasker", line 72, in <module>
    start()
  File "/home/user/bin/tasker", line 63, in start
    app = application.Application(options, args)
  File "/home/user/bin/taskcoach/taskcoachlib/patterns/singleton.py", line 29, in __call__
    class_.instance = super(Singleton, class_).__call__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/application/application.py", line 117, in __init__
    self.init(**kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/application/application.py", line 226, in init
    self.settings, splash=splash)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/mainwindow.py", line 68, in __init__
    self._create_window_components()  # Not private for test purposes
  File "/home/user/bin/taskcoach/taskcoachlib/gui/mainwindow.py", line 140, in _create_window_components
    viewer.addViewers(self.viewer, self.taskFile, self.settings)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/factory.py", line 45, in __init__
    self.__add_all_viewers()
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/factory.py", line 49, in __add_all_viewers
    self.__add_viewers(task.TaskViewer)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/factory.py", line 66, in __add_viewers
    **self._viewer_kwargs(viewer_class))
  File "/home/user/bin/taskcoach/taskcoachlib/patterns/metaclass.py", line 39, in __call__
    instance = super(NumberedInstances, cls).__call__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/task.py", line 877, in __init__
    super(TaskViewer, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/mixin.py", line 383, in __init__
    super(SortableViewerForTasksMixin, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/mixin.py", line 323, in __init__
    super(ManualOrderingMixin, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/mixin.py", line 208, in __init__
    super(SortableViewerMixin, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/base.py", line 703, in __init__
    super(ViewerWithColumns, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/task.py", line 136, in __init__
    super(BaseTaskTreeViewer, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/task.py", line 77, in __init__
    super(BaseTaskViewer, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/mixin.py", line 85, in __init__
    super(FilterableViewerMixin, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/base.py", line 583, in __init__
    super(TreeViewer, self).__init__(*args, **kwargs)
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/base.py", line 63, in __init__
    self.widget = self.createWidget()
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/task.py", line 912, in createWidget
    imageList = self.createImageList()  # Has side-effects
  File "/home/user/bin/taskcoach/taskcoachlib/gui/viewer/base.py", line 191, in createImageList
    imageList.Add(wx.ArtProvider_GetBitmap(image, wx.ART_MENU, size))
  File "/usr/lib64/python2.7/site-packages/wx-3.0-gtk2/wx/_gdi.py", line 6735, in Add
    return _gdi_.ImageList_Add(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "IsOk()" failed at /var/tmp/portage/x11-libs/wxGTK-3.0.2.0-r2/work/wxPython-src-3.0.2.0/src/gtk/bitmap.cpp(923) in GetWidth(): invalid bitmap

It also shows a GUI error message:

IDAT: chunk data is too large
07:11:19: Couldn't load a PNG image - file is corrupted or not enough memory.
07:11:19: Unknown image data format.

I tried to recompile wxwidgets and wxpython (I use gentoo), delete any data from home directory, and downloading it again from official site taskcoach.org. Nothing helped. Please help getting it working.

1

There are 1 best solutions below

0
On

I found the reason. https://sourceforge.net/p/libpng/bugs/270/?limit=25

I downgraded libpng to 1.6.29 and problem was fixed. They also have fix in git version, but still no new version issued.

libpng-1.6.32 attempts to calculate the maximum reasonable size for an IDAT chunk in pngrutil.c:png_check_chunk_length(), but it seems to assume the data has been generated by zlib or some other "reasonable" compressor which outputs data with minimal overhead. However, the PNG standard does not (as far as I can tell) include any such requirement, and indeed, https://www.w3.org/TR/PNG/ section 15.2.3(k) states that a conformant decoder must "assume[] no more than that the complete image data is represented by a single compressed datastream that is stored in some number of IDAT chunks".

Fixed in git branch libpng16, please test. It sets a larger limit for IDAT, allowing for a deflate buffer per row. Also, it uses the PNG_USER_CHUNK_MALLOC_MAX user limit, so users can set an even larger limit if they need it.