Menu

Bug in plugin Initialize()

2005-02-11
2012-12-05
  • Dave Fletcher

    Dave Fletcher - 2005-02-11

    It is not possible to load a library file using iLoader::LoadLibraryFile(...) from within a plug-in's Initialize(...) function. It segfaults when trying to read textures from inside the file.

    Backtrace:

    0xf667ccf5 in csLoader::ParseTexture (this=0x9446288, ldr_context=0x944adf8,
        node=0x944af58) at ../plugins/csparser/prstex.cpp:434
    434         tex = SCF_QUERY_INTERFACE (b, iTextureWrapper);
    (gdb) bt
    #0  0xf667ccf5 in csLoader::ParseTexture (this=0x9446288,
        ldr_context=0x944adf8, node=0x944af58)
        at ../plugins/csparser/prstex.cpp:434
    #1  0xf667b643 in csLoader::ParseTextureList (this=0x9446288,
        ldr_context=0x944adf8, node=0x944af08)
        at ../plugins/csparser/prstex.cpp:112
    #2  0xf6694e19 in csLoader::LoadLibrary (this=0x9446288,
        ldr_context=0x944adf8, node=0x9449c98)
        at ../plugins/csparser/csloader.cpp:1435
    #3  0xf6690392 in csLoader::LoadLibraryFile (this=0x9446288,
        fname=0x944a048 "/wings-data/skin/wings/index.xml", region=0x0,
        curRegOnly=true, checkDupes=false) at ../plugins/csparser/csloader.cpp:806
    #4  0xf65aae02 in wsSkinManager::LoadSkin (this=0x944abe8,
        skinfile=0xf65cae9b "wings") at ../plugins/wings/skinmgr.cpp:41
    #5  0xf65be39a in wsWings::Initialize (this=0x944a090, registry=0x9417b80)
        at ../plugins/wings/wings.cpp:147
    #6  0xf65bee51 in wsWings::WingsComponent::Initialize (this=0x944a0a4,
        parent=0x9417b80) at wings.h:40
    #7  0x080cdce9 in csPluginManager::LoadPlugin (this=0x9419608,
        classID=0x94150f0 "crystalspace.window.wings", iInterface=0x0, iVersion=0,
        init=true) at ../libs/csutil/plugmgr.cpp:223
    #8  0x080e00ee in csPluginLoader::LoadPlugins (this=0x9412518)
        at ../libs/csutil/plugldr.cpp:356
    #9  0x08090dba in csInitializer::RequestPlugins (r=0x9417b80, a=@0xfeea94f0)
        at ../libs/cstool/initapp.cpp:358
    #10 0x08090baa in csInitializer::RequestPluginsV (r=0x9417b80,
        args=0xfeea95d8 "\225�m�) at ../libs/cstool/initapp.cpp:331
    #11 0x08090a79 in csInitializer::RequestPlugins (r=0x9417b80)
        at ../libs/cstool/initapp.cpp:313
    #12 0x0808bbbd in WingsTest::Init (this=0xfeea9670, argc=2, argv=0xfeea9754)
        at ../apps/wingstest/wingstest.cpp:110
    ---Type <return> to continue, or q <return> to quit---
    #13 0x0808f794 in Run (argc=2, argv=0xfeea9754)
        at ../apps/wingstest/main.cpp:18
    #14 0x0808f7fc in main (argc=2, argv=0xfeea9754)
        at ../apps/wingstest/main.cpp:27

     
    • Dave Fletcher

      Dave Fletcher - 2005-02-11

      Update: after the original post I realized that I might not be specifying the correct <requires> in my .csplugin. I think I have everything I should need to use LoadLibraryFile, but perhaps not:

              <requires>
                <class>crystalspace.graphics3d.</class>
                <class>crystalspace.level.loader</class>
                <class>crystalspace.texture.loader.image</class>
              </requires>

       
    • F Richter

      F Richter - 2005-02-13

      Looking at the code, I guess that either no Engine is present, no 3D driver or that the 3D driver has not created a texture manager yet (most likely the latter - texture manager happens upon opening the system, which has not yet happened at init time.)

      Note that you maybe don't want to use LoadLibrary() - it'll register all those textures with the engine etc., which may not be desired for resources of the windowing system. (At least it would seem to be a good idea to use a separate region in the engine.)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.