Jump to content
The Dark Mod Forums

Circular module dependency


Recommended Posts

In the course of investigating GL issues I have encountered a crash which seems to occur because there is a circular module dependency. I'm not sure how this ever worked, since nothing I have changed so far involves module dependencies (AFAIK), unless it was just by chance:

 

ModuleRegistry: preparing to initialise module: Radiant
  Radiant needs dependency Clipper
ModuleRegistry: preparing to initialise module: Clipper
  Clipper needs dependency CommandSystem
ModuleRegistry: preparing to initialise module: CommandSystem
  CommandSystem needs dependency XMLRegistry
ModuleRegistry: dependencies satisfied, invoking initialiser for CommandSystem
CommandSystem::initialiseModule called.
=> Module CommandSystem initialised.
  Clipper needs dependency EventManager
  Clipper needs dependency PreferenceSystem
  Clipper needs dependency Radiant
  Clipper needs dependency XMLRegistry
ModuleRegistry: dependencies satisfied, invoking initialiser for Clipper
Clipper::initialiseModule called
=> Module Clipper initialised.
  Radiant needs dependency CommandSystem
  Radiant needs dependency EntityClassManager
ModuleRegistry: preparing to initialise module: EntityClassManager
  EntityClassManager needs dependency ShaderCache
  EntityClassManager needs dependency UIManager
ModuleRegistry: preparing to initialise module: UIManager
  UIManager needs dependency CommandSystem
  UIManager needs dependency EventManager
  UIManager needs dependency Radiant
  UIManager needs dependency XMLRegistry
ModuleRegistry: dependencies satisfied, invoking initialiser for UIManager

 

Note that Radiant needs Clipper and Clipper needs Radiant (I thought we got rid of the Clipper module anyway?). Also Radiant -> EntityClassManager -> UIManager -> Radiant.

 

Greebo, do you have any suggestions for the easiest way these circles could be broken?

Link to comment
Share on other sites

In the course of investigating GL issues I have encountered a crash which seems to occur because there is a circular module dependency. I'm not sure how this ever worked, since nothing I have changed so far involves module dependencies (AFAIK), unless it was just by chance:

I think we talked about this once in the past, and as far as I can recall there are modules which are using each other in their respective public methods. The only reason it's working is due to the fact that most public functions are not called before all modules are properly initialised anyway (as in the Clipper's case, nobody is clipping anything before the whole application is started up). So usually these circular dependencies are not a problem, but obviously you're getting crashes. :mellow:

 

Note that Radiant needs Clipper and Clipper needs Radiant (I thought we got rid of the Clipper module anyway?). Also Radiant -> EntityClassManager -> UIManager -> Radiant.

 

Greebo, do you have any suggestions for the easiest way these circles could be broken?

The Clipper module calls GlobalRadiant().updateAllWindows() which can be changed to radiant::getGlobalRadiant().updateAllWindows(), then the MODULE_RADIANT dependency can be removed. This solves this particular case, but I'm not sure about the UI Manager, probably something similar.

Link to comment
Share on other sites

I think I might have been barking up the wrong tree with the circular dependency issue; I remember our previous discussion now and I agree that this should not be a problem if the circular function calls are restricted to methods which will only be used after all modules are initialised.

 

The actual crash I was getting was caused by GlobalRadiant() returning a null pointer, which should never happen as far as I know. It is not happening any more, with the only change being that GlobalRadiant() no longer caches the return value in a static variable, but again this might be another irrelevance. The current intention is to replace GTKGLext with GTKGL/GTKGLArea in the hope of fixing the issues with rendering on a composited desktop, but I can't see how this could affect the module system unless there is some tricky library linkage issue going on.

Link to comment
Share on other sites

The current intention is to replace GTKGLext with GTKGL/GTKGLArea in the hope of fixing the issues with rendering on a composited desktop, but I can't see how this could affect the module system unless there is some tricky library linkage issue going on.

Ah, there is a replacement for GtkGLExt? Sounds interesting, as gtkglext is not maintained anymore, last time I checked.

Link to comment
Share on other sites

Yes, previously GtkGLArea was unmaintained, now it seems to be the other way round.

 

I did notice however that in the Floating window layout, the GL widgets worked fine with compositing (presumably because they have separate X Windows). Is this also the case in Vista/Win7? If so I won't spend much more time on this since DR is at least usable with compositing desktops even if not all layouts are available.

Link to comment
Share on other sites

Are you saying DarkRadiant doesn't fully working in Linux with (compiz) desktop composition switched on? Whoops, didn't notice that before. Or is this something new introduced with Karmic?

 

In Windows 7 or Vista all the layouts are working for me, although I had a visual glitch when using the drag-selection box in combination with Aero (due to the old xorrectangle implementation based on GtkDrawable, which I recently ripped out and replaced with something else). So right now, DR is working in all layouts in Windows XP, Vista and 7 even with Aero switched on, I don't have to switch off Desktop Composition or anything.

Link to comment
Share on other sites

Are you saying DarkRadiant doesn't fully working in Linux with (compiz) desktop composition switched on? Whoops, didn't notice that before. Or is this something new introduced with Karmic?

 

I'm using KDE, but yes, with compositing switched on the default split layout renders all gray widgets which only update for a few fractions of a second if you drag the mouse in them before going back to gray. With my GtkGLArea experiments I get exactly one widget rendered, and the others behave as with GtkGLExt (which is at least an improvement, maybe something to do with binding the current widget would fix this).

 

In Windows 7 or Vista all the layouts are working for me, although I had a visual glitch when using the drag-selection box in combination with Aero (due to the old xorrectangle implementation based on GtkDrawable, which I recently ripped out and replaced with something else). So right now, DR is working in all layouts in Windows XP, Vista and 7 even with Aero switched on, I don't have to switch off Desktop Composition or anything.

 

OK, so things are better than I thought. I'm sure I read some threads about people having to disable Aero/Compositing in order to get DR to work, but perhaps this is no longer a problem except on Linux.

Link to comment
Share on other sites

OK, so things are better than I thought. I'm sure I read some threads about people having to disable Aero/Compositing in order to get DR to work, but perhaps this is no longer a problem except on Linux.

Could still be possible, this is just my system where it's working fine. I'm using an nvidia 9700M GT, other drivers may still not play nicely along with GtkGL - some even got sluggish framerates, but that is nothing DarkRadiant can easily fix.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 6 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...