Skip to content
  • Jehan's avatar
    app: we should not have any g_assert*() code if possible. · f87bc3fe
    Jehan authored
    Replace all g_assert_not_reached() in app/core/ by g_return_if_reached()
    or g_return_val_if_reached(). GIMP may handle a lot of creative work,
    sometimes unsaved for hours. We should not just crash on purpose.
    g_assert*() could theoretically be turned off on a glib build, but this
    is nearly never done, and is not a solution either (actually it is
    probably even worse because the broken code would just continue on a
    forbidden path). It is much better to return with a warning on such
    forbidden code paths, allowing someone to report a bug without
    experiencing a crash and data loss.
    
    For now, I only took care of g_assert_not_reached() inside app/core.
    More g_assert*() code should be replaced.
    Note: assert are acceptable in plug-ins though, but not in the main
    executable, unless absolutely necessary (something happening so bad that
    crash is better than continuing).
    f87bc3fe